4

My context is marked with

this.Configuration.LazyLoadingEnabled = false;

I want to load selected related entities. Example like

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

This works fine.

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

This works fine too. But I assume this causes two separate Db calls. I want to make this in one call. How can I do that ? (I do not want to use .Include because it loads a huge list of another property values into the category object). Any ideas ?

Update

I want to load both Product and Tag at the same time without loading them separately as above.

Thilo
  • 89
  • 2
  • 7

0 Answers0