/// <summary> /// Include /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TProperty"></typeparam> /// <param name="specificationBuilder"></param> /// <param name="includeExpression"></param> /// <returns></returns> public static IIncludableSpecificationBuilder <T, TProperty> Include <T, TProperty>(this ISpecificationBuilder <T> specificationBuilder, Expression <Func <T, TProperty> > includeExpression) { var info = new IncludeExpressionInfo(includeExpression, typeof(T), typeof(TProperty)); ((List <IncludeExpressionInfo>)specificationBuilder.Specification.IncludeExpressions).Add(info); var includeBuilder = new IncludableSpecificationBuilder <T, TProperty>(specificationBuilder.Specification); return(includeBuilder); }
/// <summary> /// /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="TPreviousProperty"></typeparam> /// <typeparam name="TProperty"></typeparam> /// <param name="previousBuilder"></param> /// <param name="thenIncludeExpression"></param> /// <returns></returns> public static IIncludableSpecificationBuilder <TEntity, TProperty> ThenInclude <TEntity, TPreviousProperty, TProperty>( this IIncludableSpecificationBuilder <TEntity, IEnumerable <TPreviousProperty> > previousBuilder, Expression <Func <TPreviousProperty, TProperty> > thenIncludeExpression) where TEntity : class { var info = new IncludeExpressionInfo(thenIncludeExpression, typeof(TEntity), typeof(TProperty), typeof(TPreviousProperty)); ((List <IncludeExpressionInfo>)previousBuilder.Specification.IncludeExpressions).Add(info); var includeBuilder = new IncludableSpecificationBuilder <TEntity, TProperty>(previousBuilder.Specification); return(includeBuilder); }