Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Two-way navigation between entities #2455

Open
ssteiner opened this issue Mar 20, 2024 · 0 comments
Open

[QUESTION] Two-way navigation between entities #2455

ssteiner opened this issue Mar 20, 2024 · 0 comments
Labels

Comments

@ssteiner
Copy link

I have two entities that are linked together:

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant