public class Admin
{
public string Id {get; set;}
public string UserName {get; set;}
public List<Role> Roles {get; set;}
}
public class Role
{
public string Id {get; set;}
public string Name {get; set;}
public List<Admin> AdminInRole {get; set;
}
BsonMapper.Global.Entity<Admin>()
.DbRef(x => x.Roles , "roles");
BsonMapper.Global.Entity<Role>()
.DbRef(x => x.AdminInRole , "admins")
Is there a way to make this work so that if I insert a role into Admin, and then query the role (including AdminInRole) I'd get the admin that has been assigned the role, too?
I have two entities that are linked together:
Is there a way to make this work so that if I insert a role into Admin, and then query the role (including
AdminInRole
) I'd get the admin that has been assigned the role, too?