Tech Off Post

Single Post Permalink

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

    The most straightforward way I can think to do this involves stepping outside the "from...in" 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").