I use EF 4.1 where three tables are mapped in a m-n relationship. I am new to Linq so this will be an easy one for most of you.
The tables are Users -> Users_Rights_Map -> Rights
…a classic m-n.
I’d like to find all users that have a RightID of 1, for example.
var r = from u context.Users
where u.Rights.Select(r => r.RightID == 1)
select u;
…doesn’t work.
What does the correct LINQ query look like?
Your query syntax is wrong (
inis not in your query) and you should use some conditional function for making condition not usingselect.Edit: for linq startup and training I think is good for you to see 101 linq sample.
For
AnyYou can see Quantifiers, there are samples, likeAny,All. Specially your case included there.