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


C# IEdmEntityType.ToTypeReference方法代码示例

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


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

示例1: AddNavigationProperty

        /// <summary>Adds a new navigation property.</summary>
        /// <param name="entityType">The entity type to add the property to.</param>
        /// <param name="name">The name of the property to add.</param>
        /// <param name="deleteAction">The delete action of the nav property.</param>
        /// <param name="propertyTypeReference">The type of the property to add.</param>
        /// <param name="propertyInfo">If this is a CLR property, the <see cref="PropertyInfo"/> for the property, or null otherwise.</param>
        /// <param name="containsTarget">The contains target of the nav property</param>
        /// <returns>The newly created and added property.</returns>
        private IEdmNavigationProperty AddNavigationProperty(
            IEdmEntityType entityType,
            string name,
            EdmOnDeleteAction deleteAction,
            IEdmTypeReference propertyTypeReference,
            bool containsTarget)
        {
            // Create a navigation property representing one side of an association.
            // The partner representing the other side exists only inside this property and is not added to the target entity type,
            // so it should not cause any name collisions.
            EdmNavigationProperty navProperty = EdmNavigationProperty.CreateNavigationPropertyWithPartner(
                name,
                propertyTypeReference,
                /*dependentProperties*/ null,
                /*principalProperties*/ null,
                containsTarget,
                deleteAction,
                "Partner",
                entityType.ToTypeReference(true),
                /*partnerDependentProperties*/ null,
                /*partnerPrincipalProperties*/ null,
                /*partnerContainsTarget*/ false,
                EdmOnDeleteAction.None);

            ((EdmStructuredType)entityType).AddProperty(navProperty);

            return navProperty;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:36,代码来源:ConstructableMetadata.cs

示例2: AddReferenceProperty

        /// <summary>Helper method to add a reference property.</summary>
        /// <param name="entityType">The entity type to add the property to.</param>
        /// <param name="name">The name of the property to add.</param>
        /// <param name="targetEntitySet">The entity set the resource reference property points to.</param>
        /// <param name="targetEntityType">The entity type the entity set reference property points to.</param>
        /// <param name="resourceSetReference">true if the property should be a entity set reference, false if it should be an entity reference.</param>
        private IEdmNavigationProperty AddReferenceProperty(IEdmEntityType entityType, string name, IEdmEntitySet targetEntitySet, IEdmEntityType targetEntityType, bool resourceSetReference, bool containsTarget)
        {
            targetEntityType = targetEntityType ?? targetEntitySet.EntityType();

            IEdmTypeReference navPropertyTypeReference = resourceSetReference
                ? new EdmCollectionType(targetEntityType.ToTypeReference(true)).ToTypeReference(true)
                : targetEntityType.ToTypeReference(true);

            IEdmNavigationProperty navigationProperty = AddNavigationProperty(
                entityType,
                name,
                EdmOnDeleteAction.None,
                navPropertyTypeReference,
                containsTarget);

            return navigationProperty;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:23,代码来源:ConstructableMetadata.cs

示例3: ODataTypeAnnotation

 /// <summary>
 /// Creates a new instance of the type annotation for an entity value.
 /// </summary>
 /// <param name="navigationSource">The navigation source the entity belongs to (required).</param>
 /// <param name="entityType">The entity type of the entity value if not the base type of the entity set (optional).</param>
 public ODataTypeAnnotation(IEdmNavigationSource navigationSource, IEdmEntityType entityType)
 {
     ExceptionUtils.CheckArgumentNotNull(entityType, "entityType");
     this.navigationSource = navigationSource;
     this.type = entityType.ToTypeReference(/*isNullable*/ true);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:11,代码来源:ODataTypeAnnotation.cs


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