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


C# IEdmNavigationProperty.TargetMultiplicity方法代码示例

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


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

示例1: GetNavigationNode

        /// <summary>
        /// Builds an appropriate navigation query node (collection or single) for the given property and parent node.
        /// </summary>
        /// <param name="property">Navigation property.</param>
        /// <param name="parent">Parent Node.</param>
        /// <param name="namedValues">Named values (key values) that were included in the node we are binding, if any.</param>
        /// <param name="state">State of binding.</param>
        /// <param name="keyBinder">Object to perform binding on any key values that are present.</param>
        /// <returns>A new CollectionNavigationNode or SingleNavigationNode to capture the navigation propety access.</returns>
        internal static QueryNode GetNavigationNode(IEdmNavigationProperty property, SingleEntityNode parent, IEnumerable<NamedValue> namedValues, BindingState state, KeyBinder keyBinder)
        {
            ExceptionUtils.CheckArgumentNotNull(property, "property");
            ExceptionUtils.CheckArgumentNotNull(parent, "parent");
            ExceptionUtils.CheckArgumentNotNull(state, "state");
            ExceptionUtils.CheckArgumentNotNull(keyBinder, "keyBinder");

            // Handle collection navigation property
            if (property.TargetMultiplicity() == EdmMultiplicity.Many)
            {
                CollectionNavigationNode collectionNavigationNode = new CollectionNavigationNode(property, parent);

                // Doing key lookup on the collection navigation property
                if (namedValues != null)
                {
                    return keyBinder.BindKeyValues(collectionNavigationNode, namedValues, state.Model);
                }

                // Otherwise it's just a normal collection of entities
                return collectionNavigationNode;
            }

            Debug.Assert(namedValues == null || !namedValues.Any(), "namedValues should not exist if it isn't a colleciton");

            // Otherwise it's a single navigation property
            return new SingleNavigationNode(property, parent);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:36,代码来源:InnerPathTokenBinder.cs

示例2: CheckNavigationMultiplicity

 private void CheckNavigationMultiplicity(IEdmNavigationProperty navigation, EdmMultiplicity navigationMultiplicity, EdmMultiplicity navigationPartnerMultiplicity)
 {
     Assert.AreEqual(navigationMultiplicity, navigation.Partner.TargetMultiplicity(), "Invalid navigation property multiplicity.");
     Assert.AreEqual(navigationPartnerMultiplicity, navigation.TargetMultiplicity(), "Invalid navigation property partner multiplicity.");
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:5,代码来源:NavigationParsingTests.cs


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