Connect with Peer Bloggers

Get your Bloggers ID and network with best bloggers around the world.

11

Executing a linq query with a bridge table like aspnet_Users and aspnet_Roles

Czetsuya
czetsuya's tech ― Using model first approach, we add aspnet_Users, aspnet_Roles and aspnet_UsersInRoles in the edmx file. But why is aspnet_UsersInRoles missing? It's because aspnet_Users has one-to-many relationship to aspnet_Roles. To get the role of the user, we need to execute the linq statement below.class Person { public string UserName { get; set; } public string RoleName { get; set;}from a in _a2REntities.aspnet_Usersselect new Person { Name = a.Username, RoleName = a.aspnet_Roles.Select(p=>p.RoleName[...]

Voted by 1 User



What would you say?

Be the first to comment on this blog post! Sign in or Create an account.