您如何表示 EF4 Code-First CTP3 中的多对多关系?
例如,如果我有以下课程:
class User
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Profile> Profiles { get; set; }
}
class Profile
{
public int Id { get; set; }
public string Name { get; set; }
}
在数据库中有一个 UserProfiles 表,其中包含用户的 FK 和配置文件的 FK。我怎样才能映射这个?
编辑:我了解当前如何在 上使用ICollection<User>
属性进行映射Profile
,但是当它应该是“用户有很多个人资料”时,我真的不想拥有相反的导航属性。