/// <summary> /// Evaluates built-in function. /// </summary> /// <param name="resultType">The functionresult type.</param> /// <param name="function">The built-in function.</param> /// <param name="arguments">The arguments for the function call.</param> /// <returns>QueryValue which is the result of function evaluation.</returns> protected QueryValue EvaluateBuiltInFunction(QueryType resultType, QueryBuiltInFunction function, IEnumerable <QueryExpression> arguments) { var argumentValues = this.EvaluateArguments(arguments); var result = resultType.EvaluationStrategy.EvaluateBuiltInFunction(resultType, function.NamespaceName, function.Name, argumentValues); return(result); }
/// <summary> /// Initializes a new instance of the LinqBuiltInFunction class /// </summary> /// <param name="className">The class name that contains the method for the function call.</param> /// <param name="methodName">The method name corresponding to the function.</param> /// <param name="queryFunction">The query function metadata.</param> /// <param name="functionType">Type of the function.</param> public LinqBuiltInFunction(string className, string methodName, QueryBuiltInFunction queryFunction, LinqBuiltInFunctionKind functionType) { ExceptionUtilities.CheckStringArgumentIsNotNullOrEmpty(className, "className"); ExceptionUtilities.CheckStringArgumentIsNotNullOrEmpty(methodName, "methodName"); ExceptionUtilities.CheckArgumentNotNull(queryFunction, "queryFunction"); ExceptionUtilities.CheckArgumentNotNull(functionType, "functionType"); this.ClassName = className; this.MethodName = methodName; this.BuiltInFunction = queryFunction; this.BuiltInFunctionKind = functionType; }
/// <summary> /// Initializes a new instance of the <see cref="LinqBuiltInFunction"/> class. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="methodName">Name of the method.</param> /// <param name="queryFunction">The query function.</param> public LinqBuiltInFunction(string className, string methodName, QueryBuiltInFunction queryFunction) : this(className, methodName, queryFunction, LinqBuiltInFunctionKind.StaticMethod) { }
/// <summary> /// Resolves built-in function result type /// </summary> /// <param name="function">The funciton to resolve the result type for.</param> /// <param name="resolvedArgumentTypes">Resolved argument types.</param> /// <returns>Resolved function result type.</returns> protected QueryType ResolveBuiltInFunctionResultType(QueryBuiltInFunction function, QueryType[] resolvedArgumentTypes) { var resolvedType = function.ReturnTypeResolver != null?function.ReturnTypeResolver(resolvedArgumentTypes) : this.GetDefaultQueryType(function.ReturnType); return(resolvedType); }