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)); }
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))); }