public static Expression CreateSelection( this QueryableProjectionScope scope, Expression source, Type sourceType) { MethodCallExpression selection = Expression.Call( typeof(Enumerable), nameof(Enumerable.Select), new[] { scope.RuntimeType, scope.RuntimeType }, source, scope.CreateMemberInitLambda()); if (sourceType.IsArray) { return(ToArray(scope, selection)); } if (TryGetSetType(sourceType, out Type? setType)) { return(ToSet(selection, setType)); } return(ToList(scope, selection)); }
public static Expression <Func <T, T> > Project <T>(this QueryableProjectionScope scope) { return((Expression <Func <T, T> >)scope.CreateMemberInitLambda()); }