protected override async Task <System.Linq.IQueryable <Blog> > CreateFilteredQueryAsync(BlogListInput input) { if (input.IncludeDetails) { if (input.UseIncludeFilter) { // https://docs.microsoft.com/en-us/ef/core/querying/related-data/eager#filtered-include return((await ReadOnlyRepository.GetQueryableAsync()) .Include(x => x.Posts // Note: Ensures the collection is not loaded in to memory prior to evaluation (not really required here though) .AsQueryable() .Where(x => x.ConcurrencyStamp != null && x.ExtraProperties != null) ) // see: https://docs.microsoft.com/en-us/ef/core/querying/single-split-queries#split-queries-1 // Note: Default behaviour for collections. Creates a filtered SQL query for root 'Blog' entity, then another Query for filtered Blog.Posts when they are projected/accessed. //.AsSplitQuery() // Note: Default behaviour for on-to-one entities. Forces all data to be fetched in one query (and generates a 'LEFT JOIN' on Posts table). Can cause cartesian explosion when working with collections. //.AsSingleQuery() ); } return(await ReadOnlyRepository.WithDetailsAsync(b => b.Posts)); } return(await ReadOnlyRepository.GetQueryableAsync()); }