예제 #1
0
        public Expression GetExpression(IResolutionStrategy resolutionStrategy, TypeInformation typeInfo,
                                        ResolutionContext resolutionContext)
        {
            var args             = typeInfo.Type.GetGenericArguments();
            var wrappedType      = args.LastElement();
            var funcArgumentInfo = typeInfo.CloneForType(wrappedType);

            var parameters = args.SelectButLast(a => a.AsParameter());
            var expression = resolutionStrategy.BuildExpressionForType(resolutionContext
                                                                       .BeginContextWithFunctionParameters(parameters), funcArgumentInfo);

            return(expression?.AsLambda(typeInfo.Type, parameters));
        }
예제 #2
0
        public IEnumerable <Expression> GetExpressionsForEnumerableRequest(IResolutionStrategy resolutionStrategy, TypeInformation typeInfo,
                                                                           ResolutionContext resolutionContext)
        {
            var type             = typeInfo.Type;
            var args             = type.GetGenericArguments();
            var wrappedType      = args.LastElement();
            var funcArgumentInfo = typeInfo.CloneForType(wrappedType);

            var parameters = args.SelectButLast(a => a.AsParameter());

            return(resolutionStrategy.BuildExpressionsForEnumerableRequest(resolutionContext
                                                                           .BeginContextWithFunctionParameters(parameters), funcArgumentInfo)?
                   .Select(e => e.AsLambda(type, parameters)));
        }