抛出EF CF异常抱怨依赖角色多样性

时间:2011-12-02 10:25:14

标签: entity-framework

鉴于这两个简单的模拟类,我得到:

 System.Data.Edm.EdmAssociationEnd: : Multiplicity is not valid in Role
 'Customer2_Radio2_Target' in relationship 'Customer2_Radio2'. 
 Because the Dependent Role properties are not the key properties, the 
 upper bound of the multiplicity of the Dependent Role must be 


public class Customer2
{
    [Key]
    public int Customer2Id { get; set;}
    public Radio2 Radio2 { get; set; }
    [ForeignKey("Radio2")]
    public int Radio2Id { get; set; }
}

public class Radio2
{
    [Key]
    public int Radio2Id { get; set; }
    public Customer2 Customer2 { get; set; }
    [ForeignKey("Customer2")]
    public int? Customer2Id { get; set; }
}
好吧,我有点得到它告诉我的东西,但是真的不知道该怎么做。在Radio2上使用导航属性Customer2会非常方便。 EF似乎并不像我那样喜欢这个想法: - )

选项?

0 个答案:

没有答案