当前位置: 首页>>代码示例>>C#>>正文


C# IEdmModel.FindMatchedOperations方法代码示例

本文整理汇总了C#中IEdmModel.FindMatchedOperations方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.FindMatchedOperations方法的具体用法?C# IEdmModel.FindMatchedOperations怎么用?C# IEdmModel.FindMatchedOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEdmModel的用法示例。


在下文中一共展示了IEdmModel.FindMatchedOperations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryMatchBoundFunctionCall

        private static BoundFunctionPathSegment TryMatchBoundFunctionCall(string segment, Queue<string> segments, IEdmModel model,
            IEdmType bindingType)
        {
            Contract.Assert(model != null);
            Contract.Assert(bindingType != null);

            string nextSegment = segments.Count > 0 ? segments.Peek() : null;
            IEnumerable<IEdmOperation> matchedOperations = model.FindMatchedOperations(segment, bindingType);
            IEnumerable<IEdmFunction> possibleFunctions = matchedOperations.OfType<IEdmFunction>();
            if (possibleFunctions.Count() == 0)
            {
                return null;
            }

            IEdmEntityType currentBindingType;
            if (bindingType.TypeKind == EdmTypeKind.Collection)
            {
                currentBindingType = (IEdmEntityType)(((IEdmCollectionType)bindingType).ElementType.Definition);
            }
            else
            {
               currentBindingType = (IEdmEntityType)bindingType;
            }

            while (currentBindingType != null)
            {
                IEnumerable<IEdmFunction> matchedFunctions = possibleFunctions.Where(f => FunctionResolver.IsBoundTo(f, currentBindingType));
                BoundFunctionPathSegment functionSegment = FunctionResolver.TryResolveBound(matchedFunctions, model, nextSegment);
                if (functionSegment != null)
                {
                    if (FunctionResolver.IsEnclosedInParentheses(nextSegment))
                    {
                        segments.Dequeue();
                    }

                    return functionSegment;
                }

                currentBindingType = currentBindingType.BaseEntityType();
            }

            return null;
        }
开发者ID:nicholaspei,项目名称:aspnetwebstack,代码行数:43,代码来源:DefaultODataPathHandler.cs

示例2: TryMatchFunctionCall

        private static BoundFunctionPathSegment TryMatchFunctionCall(string segment, Queue<string> segments, IEdmModel model,
            IEdmType bindingType)
        {
            string nextSegment = segments.Count > 0 ? segments.Peek() : null;
            IEnumerable<IEdmOperation> matchOperations = model.FindMatchedOperations(segment, bindingType);
            IEnumerable<IEdmFunction> possibleFunctions = matchOperations.OfType<IEdmFunction>();

            BoundFunctionPathSegment functionSegment = FunctionResolver.TryResolveBound(possibleFunctions, model, nextSegment);
            if (functionSegment != null && FunctionResolver.IsEnclosedInParentheses(nextSegment))
            {
                segments.Dequeue();
            }

            return functionSegment;
        }
开发者ID:modulexcite,项目名称:aspnetwebstack-1,代码行数:15,代码来源:DefaultODataPathHandler.cs


注:本文中的IEdmModel.FindMatchedOperations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。