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


C# ODataNavigationLink.GetAnnotation方法代码示例

本文整理汇总了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;
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:MaterializerNavigationLink.cs

示例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);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:29,代码来源:ObjectModelWriteReadStreamer.cs

示例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;
            }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:27,代码来源:AtomObjectModelToPayloadElementConverter.cs

示例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>();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:9,代码来源:MaterializerNavigationLink.cs

示例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);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:9,代码来源:AtomMetadataODataObjectModelVisitor.cs


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