Я использую сначала код для своего проекта. и в моей базе данных есть информация. Теперь я хочу добавить поле [Display(Name = "ParentGroup", ResourceType = typeof(Resources))]
в Title
в моей модели. Но я получаю эту ошибку:
WebSite.Models.MultiString: : EntityType 'MultiString' has no key defined. Define the key for this EntityType.
MultiStrings: EntityType: EntitySet 'MultiStrings' is based on type 'MultiString' that has no keys defined.
это моя модель:
public class Group
{
[Display(Name = "Id", ResourceType = typeof(Resources))]
public int Id { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(Resources))]
[Display(Name = "Priority", ResourceType = typeof(Resources))]
public int Priority { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(Resources))]
[Display(Name = "Title", ResourceType = typeof(Resources))]
public MultiString Title { get; set; }
[Display(Name = "ParentGroup", ResourceType = typeof(Resources))]
public Nullable<int> ParentId { get; set; }
[ForeignKey("ParentId")]
[Display(Name = "ParentGroup", ResourceType = typeof(Resources))]
public virtual Group Parent { get; set; }
[Display(Name = "Abstract", ResourceType = typeof(Resources))]
public MultiString Abstract { get; set; }
[Display(Name = "Context", ResourceType = typeof(Resources))]
public MultiHtml Context { get; set; }
[Display(Name = "Active", ResourceType = typeof(Resources))]
public bool Active { get; set; }
[MaxLength(450, ErrorMessageResourceName = "MaxLength", ErrorMessageResourceType = typeof(Resources))]
[Display(Name = "ImageUrl", ResourceType = typeof(Resources))]
public string ImageUrl { get; set; }
[NotMapped]
public bool Leaf { get; set; }
public virtual ICollection<Product> Products { get; set; }
public virtual ICollection<Price> Prices { get; set; }
[Display(Name = "لیست مشخصه ها")]
public virtual ICollection<GroupProperty> Properties { get; set; }
[NotMapped]
public List<Group> Child { get; set; }
}
}
У кого-то есть решение?