Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:15:21+00:00 2026-05-22T23:15:21+00:00

I am kind of new to Entity Framework and ORMs. I have a simple

  • 0

I am kind of new to Entity Framework and ORMs. I have a simple database schema that is kind of like this.

User:
   Id
   Name

Group:
   Id
   Name

Role:
   Id
   Name

There are many-many between groups and users. Also, there is many-many between users and roles. However, Roles are per group. So we could have the following:

User A belongs to Group 1 with Roles a,b,c and belongs to Group 2, but has Roles d,e,f.

So we have some association tables like so:

UserRoles:
   UserId -> User.Id
   RoleId -> Role.Id

UserGroups
   UserId -> User.Id
   GroupId -> Group.Id

GroupRoles:
   GroupId -> Group.Id
   RoleId -> Role.Id

So, in my entities I want to have a Role entitiy, a User entity with a collection of Roles and a Group entity with a collection of Users and a collection of Roles.

When I load a group, I want to only load the users in that group and only that users roles for that group.

So my question:
In the above example. How do I make it so when I load Group 1, I want to see User A with Roles a,b,c and NOT Roles d,e,f.

Thanks,
JR

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:15:22+00:00Added an answer on May 22, 2026 at 11:15 pm

    You need to call something like Group.User.Roles to get all Roles the user belongs to in the Group. something like:

    var group1 = objectContext.Groups.Where(x => x.GroupId == 1);
    var userARoles = group1.Users.Where(x => x.UserId == "A").Roles;
    

    Does this help you?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have another question kind of relative to this but I'd like to separate
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I have a question that I just don't feel like I've found a satisfactory
intHi, Pretty new to LINQ. I have a Ratings table. A User adds a
I'm kind of new to ASN.1, so I don't know if I have invalid
I have the following in Entity Framework . Table - Country Fields List item
I recently started using Entity Framework, and it has been kind of a pain
i'm trying to implement a Repository and UnitOfWork patterns using Entity Framework. This is
How should I build the entity to achieve this post request? POST https://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID/photoid/photoID <entry
a Microsoft CRM 2011 question. Given the following parameters: An entity schema name (i.e.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.