Tech Off Post

Single Post Permalink

View Thread: LINQ to Entities and using a collection in the query...
  • User profile image

    dpratt71 said:

    The most straightforward way I can think to do this involves stepping outside the "" syntax a bit:

    var myClubs =
        from aClub in myDB.Club
        where aClub.Users.Any(aUser => aUser.City == city)
        select aClub;

    This assumes that the navigation property from Club to User is named "Users" (if you haven't changed anything, it's probably "User").

    Yup, that worked like a charm Smiley Thanks a lot!

    I hope VS will be able to tell what is not supported in LINQ queries at some point. Or even better, may be the Entity Framework will be able to translate everything you can do in code Wink