我有这个查询,我很难用lambda表达式写它。如何用lambda表达式重写此LINQ查询?
var userRoles = from ur in db.Set<IdentityUserRole>()
join r in db.Roles
on ur.RoleId equals r.Id
where ur.UserId == userId
select r.Name;
我收到Where()
子句的错误消息。
db.Set<IdentityUserRole>()
.Join(db.Roles, ur => ur.RoleId, r => r.Id, (ur, r) => r)
.Select(r => r.Name)
.Where(x => x.)
的Where
子句中的点操作后,我找不到UserId
什么是错误信息?你可以显示你尝试过的lambda吗? – Fabio
你有没有试过linqpad ...复制粘贴你的查询,它会返回你的Lambda表达式。 – loneshark99
不,直到你提到它才知道Linqpad。现在就看看它。 – StraightUp