我在我的项目中使用实体框架。
[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; }
您会看到有些有 [Required]/[Displayed],但有些没有。有什么不同?