本文整理汇总了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);
}
示例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.");
}