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


C# ResourceType.GetAnnotation方法代码示例

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


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

示例1: GetPropertyInfoResourceTypeAnnotation

        /// <summary>
        /// Gets the property info annotation for the specified resource type or creates a new one if it doesn't exist.
        /// </summary>
        /// <param name="resourceType">The resource type to get the annotation for.</param>
        /// <returns>The property info annotation.</returns>
        internal static PropertyInfoResourceTypeAnnotation GetPropertyInfoResourceTypeAnnotation(ResourceType resourceType)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");

            PropertyInfoResourceTypeAnnotation propertyInfoResourceTypeAnnotation = resourceType.GetAnnotation<PropertyInfoResourceTypeAnnotation>();
            if (propertyInfoResourceTypeAnnotation == null)
            {
                propertyInfoResourceTypeAnnotation = new PropertyInfoResourceTypeAnnotation();
                resourceType.SetAnnotation(propertyInfoResourceTypeAnnotation);
            }

            return propertyInfoResourceTypeAnnotation;
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:19,代码来源:PropertyInfoResourceTypeAnnotation.cs

示例2: AddReferenceProperty

        /// <summary>Helper method to add a reference property.</summary>
        /// <param name="resourceType">The resource type to add the property to.</param>
        /// <param name="name">The name of the property to add.</param>
        /// <param name="targetResourceSet">The resource set the resource reference property points to.</param>
        /// <param name="resourceSetReference">true if the property should be a resource set reference, false if it should be resource reference.</param>
        private void AddReferenceProperty(ResourceType resourceType, string name, ResourceSet targetResourceSet, bool resourceSetReference)
        {
            ResourceProperty property = new ResourceProperty(
                name,
                resourceSetReference ? ResourcePropertyKind.ResourceSetReference : ResourcePropertyKind.ResourceReference,
                targetResourceSet.ResourceType);
            property.CanReflectOnInstanceTypeProperty = false;
            resourceType.AddProperty(property);

            // We don't support type inheritance so the property can only point to the base resource type of the target resource set
            // We also don't support MEST, that is having two resource sets with the same resource type, so we can determine
            //   the resource set from the resource type. That also means that the property can never point to different resource sets
            //   so we can precreate the ResourceAssociationSet for this property right here as we have all the information.
            property.CustomState = new ResourcePropertyAnnotation()
            {
                ResourceAssociationSet = new ResourceAssociationSet(
                    resourceType.Name + "_" + name + "_" + targetResourceSet.Name,
                    new ResourceAssociationSetEnd(resourceType.GetAnnotation().ResourceSet, resourceType, property),
                    new ResourceAssociationSetEnd(targetResourceSet, targetResourceSet.ResourceType, null))
            };
        }
开发者ID:object,项目名称:NorthwindOData,代码行数:26,代码来源:DSPMetadata.cs

示例3: AddResourceSet

        /// <summary>Adds a resource set to the metadata definition.</summary>
        /// <param name="name">The name of the resource set to add.</param>
        /// <param name="entityType">The type of entities in the resource set.</param>
        /// <returns>The newly created resource set.</returns>
        public ResourceSet AddResourceSet(string name, ResourceType entityType)
        {
            if (entityType.ResourceTypeKind != ResourceTypeKind.EntityType)
            {
                throw new ArgumentException("The resource type specified as the base type of a resource set is not an entity type.");
            }

            ResourceSet resourceSet = new ResourceSet(name, entityType);
            entityType.GetAnnotation().ResourceSet = resourceSet;
            this.resourceSets.Add(name, resourceSet);
            return resourceSet;
        }
开发者ID:object,项目名称:NorthwindOData,代码行数:16,代码来源:DSPMetadata.cs


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