本文整理汇总了C#中IEdmEntityTypeReference.FindProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmEntityTypeReference.FindProperty方法的具体用法?C# IEdmEntityTypeReference.FindProperty怎么用?C# IEdmEntityTypeReference.FindProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmEntityTypeReference
的用法示例。
在下文中一共展示了IEdmEntityTypeReference.FindProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyNavigationProperty
/// <summary>
/// Deserializes the navigation property from <paramref name="navigationLinkWrapper"/> into <paramref name="entityResource"/>.
/// </summary>
/// <param name="entityResource">The object into which the navigation property should be read.</param>
/// <param name="navigationLinkWrapper">The navigation link.</param>
/// <param name="entityType">The entity type of the entity resource.</param>
/// <param name="readContext">The deserializer context.</param>
public virtual void ApplyNavigationProperty(object entityResource, ODataNavigationLinkWithItems navigationLinkWrapper,
IEdmEntityTypeReference entityType, ODataDeserializerContext readContext)
{
if (navigationLinkWrapper == null)
{
throw Error.ArgumentNull("navigationLinkWrapper");
}
if (entityResource == null)
{
throw Error.ArgumentNull("entityResource");
}
IEdmNavigationProperty navigationProperty = entityType.FindProperty(navigationLinkWrapper.NavigationLink.Name) as IEdmNavigationProperty;
if (navigationProperty == null)
{
throw new ODataException(
Error.Format(SRResources.NavigationPropertyNotfound, navigationLinkWrapper.NavigationLink.Name, entityType.FullName()));
}
foreach (ODataItemBase childItem in navigationLinkWrapper.NestedItems)
{
ODataEntityReferenceLinkBase entityReferenceLink = childItem as ODataEntityReferenceLinkBase;
if (entityReferenceLink != null)
{
// ignore links.
continue;
}
ODataFeedWithEntries feed = childItem as ODataFeedWithEntries;
if (feed != null)
{
ApplyFeedInNavigationProperty(navigationProperty, entityResource, feed, readContext);
continue;
}
// It must be entry by now.
ODataEntryWithNavigationLinks entry = (ODataEntryWithNavigationLinks)childItem;
if (entry != null)
{
ApplyEntryInNavigationProperty(navigationProperty, entityResource, entry, readContext);
}
}
}