How do I search for an array of values in a many to many relation?
Posted
by Kristian Gudal
on Stack Overflow
See other posts from Stack Overflow
or by Kristian Gudal
Published on 2009-07-10T16:48:44Z
Indexed on
2010/06/01
19:03 UTC
Read the original article
Hit count: 174
Hey
I have a problem with my LINQ to Entity model many to mant relation. I am new to both C# and LINQ, so bear with me.
I have a model containing pictures and tags, where each picture can have many tags, and each tag can be on many pictures. In the db there is a normal relation table, but in the object model I see it as picture.tags (as a list) and tag.pictures (as a list). A search query contains several tags, and the result of the search is to contain all pictures that are tagged with all the tags (but maybe more) I have searched for. The number of tags to search for is not fixed.
How can this best be done?
© Stack Overflow or respective owner