Many-to-Many w/ INNER JOIN
r2baka opened this issue · comments
In the examples here
https://learn.microsoft.com/en-us/ef/core/modeling/relationships/many-to-many
Describing a many-to-many between Blog Posts and Tags. Say I want to find all Blog Posts tagged with a particular tag, intuitively I would do this...
Specification
...
Query.Include(tags => tags.Where(tt => tt.TagText == searchTag));
Now, the SQL produced will be something like this:
Select Posts., Tags.
from Posts LEFT JOIN PostsTags on Posts.Id = PostsTags.PostsId...
This will give me a list of ALL Posts, and the tags will be empty.
I want to tell it to send the SQL with an INNER JOIN, rather than a LEFT join. How do I do that?
In this example, Is there a way to say, bring back only the list of Posts tagged with a particular tag?
I think I may have answered my own question already. I do this:
Query.Where(p => p.Tags.Select(f => f.TagText).Contains(searchTag));
You folks are incredible that you made that work. Thank you for this wonderful library.