本文整理汇总了C#中Microsoft.OData.Core.ODataNavigationLink.GetAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# ODataNavigationLink.GetAnnotation方法的具体用法?C# ODataNavigationLink.GetAnnotation怎么用?C# ODataNavigationLink.GetAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Core.ODataNavigationLink
的用法示例。
在下文中一共展示了ODataNavigationLink.GetAnnotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLink
/// <summary>
/// Creates the materializer link with a feed.
/// </summary>
/// <param name="link">The link.</param>
/// <param name="feed">The feed.</param>
/// <returns>The materializer link.</returns>
public static MaterializerNavigationLink CreateLink(ODataNavigationLink link, ODataFeed feed)
{
Debug.Assert(link.GetAnnotation<MaterializerNavigationLink>() == null, "there should be no MaterializerNavigationLink annotation on the feed link yet");
MaterializerNavigationLink materializedNavigationLink = new MaterializerNavigationLink(link, feed);
link.SetAnnotation<MaterializerNavigationLink>(materializedNavigationLink);
return materializedNavigationLink;
}
示例2: WriteNavigationLink
private void WriteNavigationLink(ODataWriter writer, Lazy<ODataReader> lazyReader, ODataNavigationLink link)
{
this.WriteStart(writer, link);
var expanded = link.GetAnnotation<ODataNavigationLinkExpandedItemObjectModelAnnotation>();
if (expanded != null)
{
var feed = expanded.ExpandedItem as ODataFeed;
if (feed != null)
{
this.WriteFeed(writer, lazyReader, feed);
}
else
{
ODataEntry entry = expanded.ExpandedItem as ODataEntry;
if (entry != null || expanded.ExpandedItem == null)
{
this.WriteEntry(writer, lazyReader, entry);
}
else
{
ExceptionUtilities.Assert(expanded.ExpandedItem is ODataEntityReferenceLink, "Content of a nav. link can only be a feed, entry or entity reference link.");
writer.WriteEntityReferenceLink((ODataEntityReferenceLink)expanded.ExpandedItem);
}
}
}
this.WriteEnd(writer, ODataReaderState.NavigationLinkEnd);
this.Read(lazyReader);
}
示例3: VisitNavigationLink
/// <summary>
/// Visits a navigation link item.
/// </summary>
/// <param name="navigationLink">The navigation link to visit.</param>
/// <returns>An ODataPayloadElement representing the navigation link.</returns>
protected override ODataPayloadElement VisitNavigationLink(ODataNavigationLink navigationLink)
{
ExceptionUtilities.CheckArgumentNotNull(navigationLink, "navigationLink");
NavigationPropertyInstance navigationProperty = (NavigationPropertyInstance)base.VisitNavigationLink(navigationLink);
// In ATOM even deferred links may know if they point to collection or singleton.
// So add the content type annotation to them (through it IsCollection) so that comparison is precise.
DeferredLink deferredLink = navigationProperty.Value as DeferredLink;
if (deferredLink != null && navigationLink.IsCollection.HasValue)
{
deferredLink.IsCollection(navigationLink.IsCollection.Value);
}
AtomLinkMetadata atomMetadata = navigationLink.GetAnnotation<AtomLinkMetadata>();
if (atomMetadata != null && deferredLink != null)
{
ConvertAtomLinkChildrenMetadata(atomMetadata, navigationProperty.Value);
}
return navigationProperty;
}
示例4: GetLink
/// <summary>
/// Gets the materializer link.
/// </summary>
/// <param name="link">The link.</param>
/// <returns>The materializer link.</returns>
public static MaterializerNavigationLink GetLink(ODataNavigationLink link)
{
return link.GetAnnotation<MaterializerNavigationLink>();
}
示例5: VisitNavigationLink
/// <summary>
/// Visits a navigation link item.
/// </summary>
/// <param name="navigationLink">The navigation link to visit.</param>
protected override void VisitNavigationLink(ODataNavigationLink navigationLink)
{
this.VisitAtomMetadata(navigationLink.GetAnnotation<AtomLinkMetadata>());
base.VisitNavigationLink(navigationLink);
}