Let's say I have the following database:
Users
-------
UserId (PK)
UserName
Roles
-----
RoleId (PK)
RoleName
UserRoles
---------
UserId (PK)
RoleId (PK)
Users 1-M UserRoles M-1 Roles
Using LinqToSQL, I want to return the following set:
[User1], [Role1, Role2, Role3]
[User2], [Role2, Role3]
[User3], []
Etc ...
What is the most efficient way to create this LinqToSql query?
Also, if I want to create a filter to only return users with Role1, what would it cause?
thanks.
source
share