如果表UsersInRoles是关系表,我如何更改此数据映射。 (例如,userId = 3,返回5行)。
private EntityRef<UserInRoles> roles;
[Association(Storage = "UsersInRoles", ThisKey = "UserId")]
public UserInRoles Roles
{
get { return this.roles.Entity; }
set { this.roles.Entity = value; }
}
THX
答案 0 :(得分:1)
使用EntitySet而不是EntityRef。
private EntitySet<UserInRoles> _roles;
[Association(Storage="_roles", ThisKey="UserId", OtherKey="UserId")]
public EntitySet<UserInRoles> Roles
{
get
{
return this._roles;
}
set
{
this._roles.Assign(value);
}
}