Entity Framework Request multiple collections

My context is marked

this.Configuration.LazyLoadingEnabled = false;

I want to download selected related objects. Example for example

context.Entry(catalog)
       .Collection(p => p.Products)
   .Query()
   .Where(p => p.VendorId == 1)
   .Load();

It works great.

context.Entry(catalog)
       .Collection(p => p.Tags)
   .Query()
   .Where(p => p.TagId== 1)
   .Load();

This is also great. But I guess this causes two separate Db calls. I want to make it one call. How can i do this? (I do not want to use .Include because it loads a huge list of other property values ​​into a category object). Any ideas?

Update

I want to download both the product and the tag at the same time, without downloading them separately, as described above.

+4
source share

Source: https://habr.com/ru/post/1653657/


All Articles