Another option is to do this operation in two steps:
- first find the list of users in your role by querying the
aspnet_UsersInRole
table
- then filter out the users from your
aspnet_Users
table that are in that list
Something like:
string roleName = "someRole";
// get the user id's in that role
var usersInRole = db.aspnet_UsersInRoles
.Where(ur => ur.RoleName == roleName)
.Select(ur => ur.UserId).ToList();
// then find the users that are in that list of users
var users = db.aspnet_Users.Where(u => usersInRole.Contains(u.UserId));
Of course, here in your concrete example, one of the direct approaches with a join will work - but sometimes that's just almost too tricky to express, and introducing a second step might make things easier in the end. You might even want to further limit down this list of users based on some other criteria, that might not be easily expressible with a join.
One way or another - you'll definitely be able to figure out those users! :-)