我有两个类:Customer和Association。向同一主表的两个外键
客户可以与许多客户有关联。每个关联都是定义类型(家庭,朋友等),即客户A是客户B的朋友。客户A与客户C有关。关联类型由枚举AssociationType定义。
为了在EF创建这个我已经定义了以下类
public class Customer
{
public string FirstName {get; set;}
public string LastName {get; set;}
public virtual ICollection<Association> Associations { get; set; }
}
public class Association
{
public int CustomerId { get; set; }
public virtual Customer Customer { get; set; }
public int AssociatedCustomerId { get; set; }
public virtual Customer AssociatedCustomer { get; set; }
public AssociationType AssociationType { get; set; }
}
我已经删除了数据注释,因为我无法得到这个编译。我得到的错误:
"Model compatibility cannot be checked because the database does not contain model metadata".
有没有人有任何想法?