score:3

Accepted answer

So what your trying to do per your comment

yes. Assuming: the Post A has tag1, tag2 and tag3. The post B has tag1, tag3. If the string array includes tag1 and tag2, the Post A should be selected.

Is

var posts = dbConxtext.BlogPosts.Where(x => tags.All(t => 
  x.TagsForBlogPost.Any(y => y.Tag.TagName == t)));

So make sure that All of the tags are contained in TagsForBlogPost

Warning, this may produce terrible SQL


Related Articles