I have created a edmx model of the aspnet login account holders tables.
Entityframework removes the AspNetUserRoles table and display a relationship directly between AspNetRole and the AspNetUser tables
The question I have is how or what is the best why to get a list of AspNetUser in a certain role role?
Public Function getAccountHoldersInRoles(role As String) As IEnumerable(Of AspNetUser)
Dim aspNetUsers = From u In db.AspNetUsers.Include("AspNetRoles")
For Each u In aspNetUsers
You don't need the
Include unless you have some case where you need the data after the context is disposed.
If Users and Roles have a many-to-many relationship then this is what you need.
var usersInRole = db.AspNetUsers.Where(u => u.Roles.Any(r => r.RoleName == role));
Dim usersInRole = db.AspNetUsers.Where(Function(u) u.Roles.Any(Function(r) r.RoleName = role))