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


C# ResourceType.GetLocalPropertiesLazily方法代码示例

本文整理汇总了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;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:37,代码来源:DictionaryDataContext.cs


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