I use Entity Framework in my project.
[Table("GetInfo")]
public class InDetails : IEntityWithRelationships
{
[Required]
[Key]
[Display(Name = "Primary Key", Description = "Primary Key")]
[Editable(false)]
[DatabaseGenerated(System.ComponentModel.DataAnnotations.DatabaseGeneratedOption.Identity)]
public long Pkey { get; set; }
[Required]
[Display(Name = "Facility ID", Description = "Facility ID is located at")]
public int FacilityID { get; set; }
public String Photo { get; set; }
You see some have [Required]/[Displayed], but some not.
What is the difference?
The ones without attributes are not required, in the case of
[Required]. In the case of[Display(Name =)]this tells the consuming UI layer what the displayed name and description should be. For properties with out the[Display]attribute, the property name is what gets displayed.