Ejemplo n.º 1
0
        public Expression GetExpression(
            IResolutionStrategy resolutionStrategy,
            TypeInformation typeInfo,
            ResolutionContext resolutionContext)
        {
            var newTypeInfo = typeInfo.CloneForType(typeInfo.Type.GetEnumerableType());
            var expressions = resolutionStrategy.BuildExpressionsForEnumerableRequest(resolutionContext, newTypeInfo);

            return(expressions == null?newTypeInfo.Type.InitNewArray() :
                       newTypeInfo.Type.InitNewArray(expressions));
        }
Ejemplo n.º 2
0
        public IEnumerable <Expression> GetExpressionsForEnumerableRequest(
            IResolutionStrategy resolutionStrategy,
            TypeInformation typeInfo,
            ResolutionContext resolutionContext)
        {
            var lazyArgumentInfo = typeInfo.CloneForType(typeInfo.Type.GetGenericArguments()[0]);

            var ctorParamType   = Constants.FuncType.MakeGenericType(lazyArgumentInfo.Type);
            var lazyConstructor = typeInfo.Type.GetConstructor(ctorParamType);

            return(resolutionStrategy.BuildExpressionsForEnumerableRequest(resolutionContext, lazyArgumentInfo)
                   ?.Select(e => lazyConstructor.MakeNew(e.AsLambda())));
        }
Ejemplo n.º 3
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)));
        }
Ejemplo n.º 4
0
 public IEnumerable <Expression> GetExpressionsForEnumerableRequest(
     IResolutionStrategy resolutionStrategy,
     TypeInformation typeInfo,
     ResolutionContext resolutionContext) =>
 resolutionStrategy.BuildExpressionsForEnumerableRequest(resolutionContext.BeginCrossContainerContext(resolutionContext
                                                                                                      .CurrentContainerContext.ParentContext), typeInfo);