I just ran Entity Framework and linq and wrote this query
var query = from rp in db.UM_RolePermission
where (from ru in db.UM_RoleUser
where ru.UM_User.UserID == userId select ru.RoleID).Contains(rp.RoleId)
select rp;
The above works fine and completely fills my need, however I am trying to write the same using the lambda expression to understand this.
I tried to write this, but I could not complete it.
var query1 = db.UM_RolePermission
.Where(rp => (from ru in db.UM_RoleUser where ru.UM_User.UserID == userId select ru.RoleID).Contains(rp.RoleId));
Can anyone do this?
RelationShip:
UM_RoleUser and UM_User
thank
source
share