Can someone help me with this please? I would like a simple ‘where in’. Here’s the SQL that does what I want.
select ur.RoleID
from UserRoles ur
where ur.RoleID in (5, 15)
And here’s my attempt. The method .IN() doesn’t exist obviously, just put my aggrevated thoughts lol.
int roleid;
foreach (data r in dataList) {
using (DataContext communityContext = new DataContext()) {
roleid = communityContext.UserRoles
.Where(x => x.UserID == r.ClientId && x.RoleID.IN(5, 15))
.Select(x => x.RoleID)
.First();
}
}
As you mention
Indoesn’t exist, se.Contains()instead if you have a list, in your case you could also usex.RoleId == 5 || x.RoleId == 15e.g.
then in your
whereclause do: