lambda expression join multiple tables with select and where clause

后端 未结 2 819
無奈伤痛
無奈伤痛 2020-12-28 15:25

I have three table many to many relationship I have joined the three table and select the value I want but now I need to select one row from the query result by where by spe

2条回答
  •  天涯浪人
    2020-12-28 15:46

    I was looking for something and I found this post. I post this code that managed many-to-many relationships in case someone needs it.

        var UserInRole = db.UsersInRoles.Include(u => u.UserProfile).Include(u => u.Roles)
        .Select (m => new 
        {
            UserName = u.UserProfile.UserName,
            RoleName = u.Roles.RoleName
        });
    

提交回复
热议问题