c# - How to query database if it consists of many to many mapping? -


this question has answer here:

i using entity framework 6 , project consists of fluent api mappings entites. used entity framework generator generate classes , mappings.

i have 3 tables in database

-user -roles -userroles 

userroles consists of both userid , rolesid.

entity framework generator doesnot generate userrole mapping , entity class. puts mapping in role class

i name of role based on userid. how query it.

thanks in advance.

var userid = "bad5ea54-f32b-4450-ae50-883acdfda41d"; var query = user in context.aspnetusers          user.id == userid         userrole in aspnetuserroles userrole.user == user         role in aspnetroles role == userrole.role         select role.name; 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -