I have the following table structure:
Table Users
ID | Name
1 | John
2 | Ted
3 | Alice
4 | Barney
and table UserLanguages
ID | UserID | Language
1 | 1 | 1
2 | 1 | 5
3 | 2 | 2
4 | 2 | 3
5 | 3 | 3
6 | 4 | 4
7 | 4 | 5
I check languages 2,3 and 4 and I want to get users: 2,3,4.
I want to get users who have at least something of chosen languages (or 2 or 3 or 4)
How get with LINQ?
Something like this should work:
My suggestion of using predicate builder is overly complicated.
IEnumerable<T>.Contains()apparently works in LINQ-to-SQL (which I didn’t know). This should be much easier.