public ExpressionResolutionResult GetExpressionResolutionResult(
            ExpressionResolutionResult expressionResolutionResult, IMemberMap propertyMap, LetPropertyMaps letPropertyMaps)
        {
            var mapFrom = propertyMap.CustomMapExpression;

            if (!IsSubQuery() || letPropertyMaps.ConfigurationProvider.ResolveTypeMap(propertyMap.SourceType, propertyMap.DestinationType) == null)
            {
                return(new ExpressionResolutionResult(mapFrom.ReplaceParameters(propertyMap.CheckCustomSource(expressionResolutionResult, letPropertyMaps))));
            }
            if (propertyMap.CustomSource == null)
            {
                return(new ExpressionResolutionResult(letPropertyMaps.GetSubQueryMarker(mapFrom), mapFrom));
            }
            var newMapFrom = Lambda(mapFrom.ReplaceParameters(propertyMap.CustomSource.Body), propertyMap.CustomSource.Parameters);

            return(new ExpressionResolutionResult(letPropertyMaps.GetSubQueryMarker(newMapFrom), newMapFrom));

            bool IsSubQuery()
            {
                if (!(mapFrom.Body is MethodCallExpression methodCall))
                {
                    return(false);
                }
                var method = methodCall.Method;

                return(method.IsStatic && method.DeclaringType == typeof(Enumerable));
            }
        }
 public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, IMemberMap propertyMap, LetPropertyMaps letPropertyMaps)
 => new ExpressionResolutionResult(propertyMap.SourceMembers.MemberAccesses(propertyMap.CheckCustomSource(expressionResolutionResult, letPropertyMaps)));