我尝试查询aspnet成员资格表,并获取特定应用中可以位于角色列表中的所有用户的电子邮件列表。我传递了角色的guid列表。如果我把&&&& r.RoleId in,查询的其余部分有效,但我试图找出如何查询Guid的角色ID列表。
from m in Aspnet_Memberships
join u in Aspnet_Users on m.UserId equals u.UserId
join ur in Aspnet_UsersInRoles on u.UserId equals ur.UserId
join r in Aspnet_Roles on ur.RoleId equals r.RoleId
join a in Applications on r.WebApplicationID equals a.ApplicationId
where a.ApplicationId == new Guid("55555555-4444-3333-2222-111111111111")
&& r.RoleId in rolesList //rolesList is a List<Guid>
select new {
m.Email,
u.UserName,
a.ApplicationName,
r.RoleName
}
答案 0 :(得分:1)
您需要Contains
rolesList.Contains(r.RoleId)