本文整理汇总了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;
}
示例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;
}