/// <summary> /// Replaces method <see cref="IncludeQueryableExtensions.ThenInclude{T, TPreviousProperty, TProperty}(IIncludableQueryable{T, TPreviousProperty}, SystemLinq.Expression{Func{TPreviousProperty, TProperty}})"/> /// and <see cref="IncludeQueryableExtensions.ThenInclude{T, TPreviousProperty, TProperty}(IIncludableQueryable{T, TPreviousProperty}, SystemLinq.Expression{Func{TPreviousProperty, TProperty}})"/> /// by <see cref="IncludeQueryableExtensions.Include{T, TProperty}(IQueryable{T}, SystemLinq.Expression{Func{T, TProperty}})"/> with sub-selects. /// </summary> public static Expression ReplaceThenIncludeQueryMethodsBySubSelects(this Expression expression) { var mapped = new QueryMethodMapper().Run(expression); var cleaned = new StackedQueryableCleaner(StackedQueryableCleaner.Strategy.SubSelect).Run(mapped); return(cleaned); }
/// <summary> /// Replaces method <see cref="IncludeQueryableExtensions.Include{T, TProperty}(IQueryable{T}, SystemLinq.Expression{Func{T, TProperty}})"/>, /// <see cref="IncludeQueryableExtensions.ThenInclude{T, TPreviousProperty, TProperty}(IIncludableQueryable{T, TPreviousProperty}, SystemLinq.Expression{Func{TPreviousProperty, TProperty}})"/>, and /// <see cref="IncludeQueryableExtensions.ThenInclude{T, TPreviousProperty, TProperty}(IIncludableQueryable{T, TPreviousProperty}, SystemLinq.Expression{Func{TPreviousProperty, TProperty}})"/> /// by <see cref="IncludeQueryableExtensions.Include{T}(IQueryable{T}, string)"/>. /// </summary> public static Expression ReplaceIncludeQueryMethodsByStringInclude(this Expression expression, Func <Type, MethodInfo>?stringIncludeMethodInfoProvider = null) { var mapped = new QueryMethodMapper(stringIncludeMethodInfoProvider).Run(expression); var cleaned = new StackedQueryableCleaner().Run(mapped); return(cleaned); }