我的模型定义如下:
{
[Key]
[DatabaseGenerated (DatabaseGeneratedOption.None)]
//[HiddenInput(DisplayValue = false)]
public string ODID { get; set; }
[Required(ErrorMessage = "Введите ИНН")]
public long AuthorityINN { get; set; }
public int AuthorityID { get; set; }
[Required(ErrorMessage = "Введите наименование набора данных")]
public string Name { get; set; }
[Required(ErrorMessage = "Введите краткое описание")]
public string Description { get; set; }
[DataType(DataType.MultilineText)]
[Required(ErrorMessage = "Введите полное описание")]
public string FullDescription { get; set; }
public int CategoryID { get; set; }
public bool IsPublished { get; set; }
//public int OwnerID {get;set;}
public Periodicity Periodicity { get; set; }
public string KeyWords { get; set; }
public int UserID { get; set; }
public DateTime CreateDate { get; set; }
public bool HasGeo { get; set; }
public long Reviews { get; set; }
public long Downloads { get; set; }
}
但是我抓住了一个System.Data.Entity.ModelConfiguration.ModelValidationException
异常并带有一条消息:
定义此EntityType的键。
可能是什么问题?