Entity LINQ on many-to-many got error "LINQ to Entities does not recognize the method 'Boolean Conta

Posted by user300992 on Stack Overflow See other posts from Stack Overflow or by user300992
Published on 2010-04-14T20:10:01Z Indexed on 2010/04/14 20:13 UTC
Read the original article Hit count: 503

Filed under:
|

I have 2 tables (Users and Roles) they are mapped as Many-to-Many in relational db. When I imported to Entity Data Content, they are still staying as the same relationship.

Since they are mapped as Many-To-Many in Entity, I can access

Users.RoleCollection 
or
Roles.UserCollection

However, when I execute this LINQ query, I got "LINQ to Entities does not recognize the method 'Boolean Contains... method, and this method cannot be translated into a store expression."

var result (from a in Users
            from b in Roles
            where a.RoleCollection.Contains(b)
            select a);

I think I must did something wrong... please help.

© Stack Overflow or respective owner

Related posts about linq-to-entities

Related posts about LINQ