/// <summary> /// Gets the function as specified by the function key. /// All parameters are assumed to be <see cref="ParameterMode.In" />. /// </summary> /// <param name="functionName"> Name of the function </param> /// <param name="parameterTypes"> types of the parameters </param> /// <param name="ignoreCase"> true for case-insensitive lookup </param> /// <param name="function"> The function that needs to be returned </param> /// <returns> The function as specified in the function key or null </returns> /// <exception cref="System.ArgumentNullException">if functionName or parameterTypes argument is null</exception> /// <exception cref="System.ArgumentException">if no function is found with the given name or with given input parameters</exception> internal bool TryGetFunction(string functionName, TypeUsage[] parameterTypes, bool ignoreCase, out EdmFunction function) { Check.NotNull(functionName, "functionName"); Check.NotNull(parameterTypes, "parameterTypes"); var functionIdentity = EdmFunction.BuildIdentity(functionName, parameterTypes); GlobalItem item = null; function = null; if (TryGetValue(functionIdentity, ignoreCase, out item) && Helper.IsEdmFunction(item)) { function = (EdmFunction)item; return(true); } return(false); }
internal bool TryGetFunction( string functionName, TypeUsage[] parameterTypes, bool ignoreCase, out EdmFunction function) { Check.NotNull <string>(functionName, nameof(functionName)); Check.NotNull <TypeUsage[]>(parameterTypes, nameof(parameterTypes)); string identity = EdmFunction.BuildIdentity(functionName, (IEnumerable <TypeUsage>)parameterTypes); GlobalItem globalItem = (GlobalItem)null; function = (EdmFunction)null; if (!this.TryGetValue(identity, ignoreCase, out globalItem) || !Helper.IsEdmFunction(globalItem)) { return(false); } function = (EdmFunction)globalItem; return(true); }