public Aggregate(Expression target, FunctionName funcName, params string[] args) : base(target, funcName, args) { selectionPath = args != null && args.Length > 0 ? args[0] : null; var targetType = target.Type; var methodName = funcName.ToString(); callInfo = supportedMethods.FirstOrDefault(m => m.TargetType == targetType && m.MethodName.Equals(methodName, StringComparison.OrdinalIgnoreCase)); if (callInfo == null) { if (targetType.IsGenericType) { var argType = targetType.GetGenericArguments()[0]; callInfo = new MethodInspect(methodName, targetType, argType, typeof(Enumerable)); } else if (targetType.IsArray) { var argType = targetType.GetElementType(); callInfo = new MethodInspect(methodName, targetType, argType, typeof(Enumerable)); } } if (callInfo == null) { throw new NotSupportedException("Operator in condition is not supported for field type"); } }
public SelectMany(Expression target, params string[] args) : base(target, FunctionName.SelectMany, args) { if (args == null || args.Length != 1) { throw new ArgumentException($"Exactly one argument is required for function '{FunctionName.SelectMany}'"); } selectionPath = args[0]; callInfo = new MethodInspect("SelectMany", target.Type, typeof(string), typeof(Enumerable)); }