本文整理汇总了C#中IEdmModel.ResolveOperations方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.ResolveOperations方法的具体用法?C# IEdmModel.ResolveOperations怎么用?C# IEdmModel.ResolveOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.ResolveOperations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOperationsInEntry
/// <summary>
/// Returns a hash set of operation imports (actions and functions) in the given entry.
/// </summary>
/// <param name="entry">The entry in question.</param>
/// <param name="model">The edm model to resolve operation imports.</param>
/// <param name="metadataDocumentUri">The metadata document uri.</param>
/// <returns>The hash set of operation imports (actions and functions) in the given entry.</returns>
private static HashSet<IEdmOperation> GetOperationsInEntry(ODataEntry entry, IEdmModel model, Uri metadataDocumentUri)
{
Debug.Assert(entry != null, "entry != null");
Debug.Assert(model != null, "model != null");
Debug.Assert(metadataDocumentUri != null && metadataDocumentUri.IsAbsoluteUri, "metadataDocumentUri != null && metadataDocumentUri.IsAbsoluteUri");
HashSet<IEdmOperation> edmOperationImportsInEntry = new HashSet<IEdmOperation>(EqualityComparer<IEdmOperation>.Default);
IEnumerable<ODataOperation> operations = ODataUtilsInternal.ConcatEnumerables((IEnumerable<ODataOperation>)entry.NonComputedActions, (IEnumerable<ODataOperation>)entry.NonComputedFunctions);
if (operations != null)
{
foreach (ODataOperation operation in operations)
{
Debug.Assert(operation.Metadata != null, "operation.Metadata != null");
string operationMetadataString = UriUtils.UriToString(operation.Metadata);
Debug.Assert(
ODataJsonLightUtils.IsMetadataReferenceProperty(operationMetadataString),
"ODataJsonLightUtils.IsMetadataReferenceProperty(operationMetadataString)");
Debug.Assert(
operationMetadataString[0] == ODataConstants.ContextUriFragmentIndicator || metadataDocumentUri.IsBaseOf(operation.Metadata),
"operationMetadataString[0] == JsonLightConstants.ContextUriFragmentIndicator || metadataDocumentUri.IsBaseOf(operation.Metadata)");
string fullyQualifiedOperationName = ODataJsonLightUtils.GetUriFragmentFromMetadataReferencePropertyName(metadataDocumentUri, operationMetadataString);
IEnumerable<IEdmOperation> edmOperations = model.ResolveOperations(fullyQualifiedOperationName);
if (edmOperations != null)
{
foreach (IEdmOperation edmOperation in edmOperations)
{
edmOperationImportsInEntry.Add(edmOperation);
}
}
}
}
return edmOperationImportsInEntry;
}