src/Shared/EntityFramework/Core/Metadata/Edm/Perspective.cs
// <summary>
// Returns overloads of a function with the given name in the target space.
// </summary>
// <param name="namespaceName"> namespace of the function </param>
// <param name="functionName"> name of the function </param>
// <param name="ignoreCase"> true for case-insensitive lookup </param>
// <param name="functionOverloads"> function overloads </param>
// <returns> returns true if a match was found, otherwise false </returns>
Returns overloads of a function with the given name in the target space.
Returns overloads of a function with the given name in the target space .
internal bool TryGetFunctionByName(
            string namespaceName, string functionName, bool ignoreCase, out IList<EdmFunction> functionOverloads)
        {
            Check.NotEmpty(namespaceName, "namespaceName");
            Check.NotEmpty(functionName, "functionName");
            var fullName = namespaceName + "." + functionName;
            var itemCollection = _metadataWorkspace.GetItemCollection(_targetDataspace);
            IList<EdmFunction> overloads =
                _targetDataspace == DataSpace.SSpace
                    ? ((StoreItemCollection)itemCollection).GetCTypeFunctions(fullName, ignoreCase)
                    : itemCollection.GetFunctions(fullName, ignoreCase);
            if (_targetDataspace == DataSpace.CSpace)
            {
                if (overloads == null
                    || overloads.Count == 0)
                {
                    EntityContainer entityContainer;
                    if (TryGetEntityContainer(namespaceName,  false, out entityContainer))
                    {
                        EdmFunction functionImport;
                        if (TryGetFunctionImport(entityContainer, functionName,  false, out functionImport))
                        {
                            overloads = new[] { functionImport };
                        }
                    }
                }
                if (overloads == null
                    || overloads.Count == 0)
                {
                    ItemCollection storeItemCollection;
                    if (_metadataWorkspace.TryGetItemCollection(DataSpace.SSpace, out storeItemCollection))
                    {
                        overloads = ((StoreItemCollection)storeItemCollection).GetCTypeFunctions(fullName, ignoreCase);
                    }
                }
            }
            functionOverloads = (overloads != null && overloads.Count > 0) ? overloads : null;
            return functionOverloads != null;
        }
internal bool TryGetFunctionByName ( string namespaceName , string functionName , bool ignoreCase , out IList < EdmFunction > functionOverloads ) { Check . NotEmpty ( namespaceName , " " ) ; Check . NotEmpty ( functionName , " " ) ; var fullName = namespaceName + " " + functionName ; var itemCollection = _metadataWorkspace . GetItemCollection ( _targetDataspace ) ; IList < EdmFunction > overloads = _targetDataspace == DataSpace . SSpace ? ( ( StoreItemCollection ) itemCollection ) . GetCTypeFunctions ( fullName , ignoreCase ) : itemCollection . GetFunctions ( fullName , ignoreCase ) ; if ( _targetDataspace == DataSpace . CSpace ) { if ( overloads == null || overloads . Count == 0 ) { EntityContainer entityContainer ; if ( TryGetEntityContainer ( namespaceName , false , out entityContainer ) ) { EdmFunction functionImport ; if ( TryGetFunctionImport ( entityContainer , functionName , false , out functionImport ) ) { overloads = new [ ] { functionImport } ; } } } if ( overloads == null || overloads . Count == 0 ) { ItemCollection storeItemCollection ; if ( _metadataWorkspace . TryGetItemCollection ( DataSpace . SSpace , out storeItemCollection ) ) { overloads = ( ( StoreItemCollection ) storeItemCollection ) . GetCTypeFunctions ( fullName , ignoreCase ) ; } } } functionOverloads = ( overloads != null && overloads . Count > 0 ) ? overloads : null ; return functionOverloads != null ; }
Returns overloads of a function with the given name in the target space.
Returns overloads of a function with the given name in the target space .
// First look for a model-defined function in the target space. // Then look for a function import. /*ignoreCase:*/ /*ignoreCase:*/ // Last, look in SSpace.
returns true if a match was found, otherwise false
returns true if a match was found otherwise false
namespaceName
string
namespace of the function
namespace of the function
functionName
string
name of the function
name of the function
ignoreCase
bool
true for case-insensitive lookup
true for case - insensitive lookup
IList<EdmFunction>
out
functionOverloads
None