Showing posts with label EF Core AsSplitQuery.AsSplitQuery. Show all posts
Showing posts with label EF Core AsSplitQuery.AsSplitQuery. Show all posts

Sunday, November 10, 2024

EF Core AsSplitQuery

 AsSplitQuery will perform separate queries instead of complex joins when returning data from multiple tables. 

When using a single query result with data from multiple tables,  there is a probability of   “cartesian explosion” of duplicate data across many columns and rows.


e.g

  var result =dbContext.Student.Where(s=> s.Id == id)

      .Include(x => x.Books)

      .ThenInclude(x => x.Overdues)

      .AsSplitQuery();


Cheers,

Samitha