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)); }
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()))); }
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))); }
public IEnumerable <Expression> GetExpressionsForEnumerableRequest( IResolutionStrategy resolutionStrategy, TypeInformation typeInfo, ResolutionContext resolutionContext) => resolutionStrategy.BuildExpressionsForEnumerableRequest(resolutionContext.BeginCrossContainerContext(resolutionContext .CurrentContainerContext.ParentContext), typeInfo);