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


C# IEdmNavigationProperty.ToEntityType方法代码示例

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


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

示例1: EdmUnknownEntitySet

        /// <summary>
        /// Initializes a new instance of the <see cref="EdmUnknownEntitySet"/> class.
        /// </summary>
        /// <param name="parentNavigationSource">The <see cref="IEdmNavigationSource"/> that container element belongs to</param>
        /// <param name="navigationProperty">An <see cref="IEdmNavigationProperty"/> containing the navagation property definition of the contained element</param>
        public EdmUnknownEntitySet(IEdmNavigationSource parentNavigationSource, IEdmNavigationProperty navigationProperty)
            : base(navigationProperty.Name, navigationProperty.ToEntityType())
        {
            EdmUtil.CheckArgumentNull(parentNavigationSource, "parentNavigationSource");
            EdmUtil.CheckArgumentNull(navigationProperty, "navigationProperty");

            this.parentNavigationSource = parentNavigationSource;
            this.navigationProperty = navigationProperty;
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:14,代码来源:EdmUnknownEntitySet.cs

示例2: NavigationPathSegment

        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationPathSegment" /> class.
        /// </summary>
        /// <param name="previous">The property being accessed by this segment.</param>
        /// <param name="navigationProperty">The navigation property being accessed by this segment.</param>
        public NavigationPathSegment(ODataPathSegment previous, IEdmNavigationProperty navigationProperty)
            : base(previous)
        {
            if (navigationProperty == null)
            {
                throw Error.ArgumentNull("navigation");
            }

            if (previous.EntitySet == null)
            {
                throw Error.Argument(SRResources.PreviousSegmentMustHaveEntitySet);
            }

            EdmType = navigationProperty.Partner.Multiplicity() == EdmMultiplicity.Many ?
                (IEdmType)navigationProperty.ToEntityType().GetCollection() :
                (IEdmType)navigationProperty.ToEntityType();
            EntitySet = previous.EntitySet.FindNavigationTarget(navigationProperty);
            NavigationProperty = navigationProperty;
        }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:24,代码来源:NavigationPathSegment.cs

示例3: GetNavigationChildItem

        private static ExplorerItem GetNavigationChildItem(IEdmNavigationProperty property, List<ExplorerItem> schema)
        {
            var partnerType = property.ToEntityType();

            var backReferenceType = partnerType.DeclaredNavigationProperties()
                                               .FirstOrDefault(o => o.ToEntityType() == property.DeclaringEntityType());

            var isCollection = property.Type.IsCollection();
            var kind = isCollection ? ExplorerItemKind.CollectionLink : ExplorerItemKind.ReferenceLink;
            ExplorerIcon icon;

            if (backReferenceType == null)
                icon = ExplorerIcon.Column;
            else if (isCollection)
                icon = backReferenceType.Type.IsCollection() ? ExplorerIcon.ManyToMany : ExplorerIcon.OneToMany;
            else
                icon = backReferenceType.Type.IsCollection() ? ExplorerIcon.ManyToOne : ExplorerIcon.OneToOne;

            var item = new ExplorerItem(property.Name, kind, icon)
                                    {
                                        ToolTipText = partnerType.Name,
                                        HyperlinkTarget = schema.FirstOrDefault(a => (IEdmEntityType)a.Tag == partnerType),
                                        DragText = property.Name
                                    };

            return item;
        }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:27,代码来源:Extensions.cs

示例4: ParseLevels

        /// <summary>
        /// Parse from levelsOption token to LevelsClause.
        /// Negative value would be treated as max.
        /// </summary>
        /// <param name="levelsOption">The levelsOption for current expand.</param>
        /// <param name="sourceType">The type of current level navigation source.</param>
        /// <param name="property">Navigation property for current expand.</param>
        /// <returns>The LevelsClause parsed, null if levelsOption is null</returns>
        private LevelsClause ParseLevels(long? levelsOption, IEdmType sourceType, IEdmNavigationProperty property)
        {
            if (!levelsOption.HasValue)
            {
                return null;
            }

            IEdmType relatedType = property.ToEntityType();

            if (sourceType != null && relatedType != null && !UriEdmHelpers.IsRelatedTo(sourceType, relatedType))
            {
                throw new ODataException(ODataErrorStrings.ExpandItemBinder_LevelsNotAllowedOnIncompatibleRelatedType(property.Name, relatedType.ODataFullName(), sourceType.ODataFullName()));
            }

            return new LevelsClause(levelsOption.Value < 0, levelsOption.Value);
        }
开发者ID:vebin,项目名称:odata.net,代码行数:24,代码来源:SelectExpandBinder.cs

示例5: DecorateExpandWithSelect

 /// <summary>
 /// Decorate an expand tree using a select token.
 /// </summary>
 /// <param name="subExpand">the already built sub expand</param>
 /// <param name="currentNavProp">the current navigation property</param>
 /// <param name="select">the select token to use</param>
 /// <returns>A new SelectExpand clause decorated with the select token.</returns>
 private SelectExpandClause DecorateExpandWithSelect(SelectExpandClause subExpand, IEdmNavigationProperty currentNavProp, SelectToken select)
 {
     SelectBinder selectBinder = new SelectBinder(this.Model, currentNavProp.ToEntityType(), this.Settings.SelectExpandLimit, subExpand, this.configuration.Resolver);
     return selectBinder.Bind(select);
 }
开发者ID:vebin,项目名称:odata.net,代码行数:12,代码来源:SelectExpandBinder.cs

示例6: GenerateSubExpand

 /// <summary>
 /// Generate a SubExpand based on the current nav property and the curren token
 /// </summary>
 /// <param name="currentNavProp">the current navigation property</param>
 /// <param name="tokenIn">the current token</param>
 /// <returns>a new SelectExpand clause bound to the current token and nav prop</returns>
 private SelectExpandClause GenerateSubExpand(IEdmNavigationProperty currentNavProp, ExpandTermToken tokenIn)
 {
     SelectExpandBinder nextLevelBinder = new SelectExpandBinder(this.Configuration, currentNavProp.ToEntityType(), this.NavigationSource != null ? this.NavigationSource.FindNavigationTarget(currentNavProp) : null);
     return nextLevelBinder.BindSubLevel(tokenIn.ExpandOption);
 }
开发者ID:vebin,项目名称:odata.net,代码行数:11,代码来源:SelectExpandBinder.cs


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