This is my first post on channel9 so let me start by saying "Hi!" I hope the holiday season has been treating you all well.
Now, onto the problem I have been having with LINQ...
I am new to LINQ and I have been trying to do something pretty simple with a DB I am playing around with: There are 3 tables, User, UserToClub, and Club. UserToClub maps clubs to a given user and has the user's ID and the club's ID as FKs. When I generated EDMX for this DB I got two Entities - User and Club. I just want to filter clubs based on a given list of users, in this case based on a given city. The code compiles fine but I get a runtime error when I try to call Count on myClubs which I guess is when the statement gets actually evaluated. The error is:
LINQ to Entities does not recognize the method 'Boolean Contains(Club)' method, and this method cannot be translated into a store expression. (System.NotSupportedException)
Any help would be appreciated. The code follows:
//Pick user with the right ID
var myUser = from aUser in myDB.User
//Filter clubs based on user ID
var myClubs = from aUser in myUser
from aClub in myDB.Club
It seems pretty straightforward to me but I guess I am missing something (yeah, "Doh!", I know...).
Just when I was starting to really love LINQ...