本文整理汇总了C#中Microsoft.OData.Service.Providers.ResourceType.GetLocalPropertiesLazily方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceType.GetLocalPropertiesLazily方法的具体用法?C# ResourceType.GetLocalPropertiesLazily怎么用?C# ResourceType.GetLocalPropertiesLazily使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Service.Providers.ResourceType
的用法示例。
在下文中一共展示了ResourceType.GetLocalPropertiesLazily方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResourceAssociationSet
/// <summary>
/// Gets the resource association set with the given values
/// </summary>
/// <param name="resourceSet">The resource set</param>
/// <param name="resourceType">The resource type</param>
/// <param name="resourceProperty">The resource property</param>
/// <returns>The resource association set</returns>
public virtual ResourceAssociationSet GetResourceAssociationSet(ResourceSet resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
{
ExceptionUtilities.CheckArgumentNotNull(resourceSet, "resourceSet");
ExceptionUtilities.CheckArgumentNotNull(resourceType, "resourceType");
ExceptionUtilities.CheckArgumentNotNull(resourceProperty, "resourceProperty");
ExceptionUtilities.Assert(
(resourceProperty.Kind & (ResourcePropertyKind.ResourceReference | ResourcePropertyKind.ResourceSetReference)) != 0,
"GetResourceAssociationSet called with non-navigation property '{0}' of kind '{1}'.",
resourceProperty.Name,
resourceProperty.Kind);
ExceptionUtilities.Assert(resourceType.GetLocalPropertiesLazily().Contains(resourceProperty), "ResourceProperty '{0}' must be on the ResourceType '{1}' when finding the ResourceAssociationSet", resourceProperty.Name, resourceType.Name);
ExceptionUtilities.Assert(this.metadataHelper.GetResourceTypesOfResourceSet(resourceSet).Contains(resourceType), "ResourceSet '{0}' does not contain ResourceType '{1}'", resourceSet.Name, resourceType.Name);
foreach (var associationSet in this.metadataHelper.ResourceAssociationSets)
{
if (associationSet.End1.ResourceSet == resourceSet && associationSet.End1.ResourceType == resourceType && associationSet.End1.ResourceProperty == resourceProperty)
{
return this.EnforceMetadataCache(associationSet, resourceSet, resourceType, resourceProperty, true);
}
if (associationSet.End2.ResourceSet == resourceSet && associationSet.End2.ResourceType == resourceType && associationSet.End2.ResourceProperty == resourceProperty)
{
return this.EnforceMetadataCache(associationSet, resourceSet, resourceType, resourceProperty, true);
}
}
return null;
}