protected override void EndFeed(ODataFeed feed) { AtomFeedScope currentFeedScope = this.CurrentFeedScope; if (!currentFeedScope.AuthorWritten && (currentFeedScope.EntryCount == 0)) { this.atomEntryAndFeedSerializer.WriteFeedDefaultAuthor(); } this.atomEntryAndFeedSerializer.WriteFeedNextPageLink(feed); this.atomOutputContext.XmlWriter.WriteEndElement(); this.CheckAndWriteParentNavigationLinkEndForInlineElement(); }
/// <summary> /// Writes the collection of <see cref="ODataInstanceAnnotation"/> for the given <paramref name="feed"/> to the ATOM payload. /// </summary> /// <param name="feed">The feed to write the <see cref="ODataInstanceAnnotation"/> for.</param> /// <param name="currentFeedScope">The current feed scope.</param> private void WriteFeedInstanceAnnotations(ODataFeed feed, AtomFeedScope currentFeedScope) { if (this.IsTopLevel) { this.WriteInstanceAnnotations(feed.InstanceAnnotations, currentFeedScope.InstanceAnnotationWriteTracker); } else { if (feed.InstanceAnnotations.Count > 0) { throw new ODataException(OData.Core.Strings.ODataJsonLightWriter_InstanceAnnotationNotSupportedOnExpandedFeed); } } }
/// <summary> /// Finish writing a feed. /// </summary> /// <param name="feed">The feed to write.</param> protected override void EndFeed(ODataFeed feed) { Debug.Assert(feed != null, "feed != null"); Debug.Assert( this.ParentNavigationLink == null || this.ParentNavigationLink.IsCollection.Value, "We should have already verified that the IsCollection matches the actual content of the link (feed/entry)."); AtomFeedScope currentFeedScope = this.CurrentFeedScope; if (!currentFeedScope.AuthorWritten && currentFeedScope.EntryCount == 0) { // Write an empty author if there were no entries, since the feed must have an author if the entries don't have one as per ATOM spec this.atomEntryAndFeedSerializer.WriteFeedDefaultAuthor(); } this.atomEntryAndFeedSerializer.WriteFeedNextPageLink(feed); // </atom:feed> this.atomOutputContext.XmlWriter.WriteEndElement(); this.CheckAndWriteParentNavigationLinkEndForInlineElement(); }
/// <summary> /// Finish writing a feed. /// </summary> /// <param name="feed">The feed to write.</param> protected override void EndFeed(ODataFeed feed) { Debug.Assert(feed != null, "feed != null"); Debug.Assert( this.ParentNavigationLink == null || this.ParentNavigationLink.IsCollection.Value, "We should have already verified that the IsCollection matches the actual content of the link (feed/entry)."); AtomFeedScope currentFeedScope = this.CurrentFeedScope; if (!currentFeedScope.AuthorWritten && currentFeedScope.EntryCount == 0) { // Write an empty author if there were no entries, since the feed must have an author if the entries don't have one as per ATOM spec this.atomEntryAndFeedSerializer.WriteFeedDefaultAuthor(); } this.WriteFeedInstanceAnnotations(feed, currentFeedScope); this.atomEntryAndFeedSerializer.WriteFeedNextPageLink(feed); // Write delta link only in case of writing response for a top level feed. if (this.IsTopLevel) { if (this.atomOutputContext.WritingResponse) { this.atomEntryAndFeedSerializer.WriteFeedDeltaLink(feed); } } else { this.ValidateNoDeltaLinkForExpandedFeed(feed); } // </atom:feed> this.atomOutputContext.XmlWriter.WriteEndElement(); this.CheckAndWriteParentNavigationLinkEndForInlineElement(); }
/// <summary> /// Writes the collection of <see cref="ODataInstanceAnnotation"/> for the given <paramref name="feed"/> to the ATOM payload. /// </summary> /// <param name="feed">The feed to write the <see cref="ODataInstanceAnnotation"/> for.</param> /// <param name="currentFeedScope">The current feed scope.</param> private void WriteFeedInstanceAnnotations(ODataFeed feed, AtomFeedScope currentFeedScope) { if (this.IsTopLevel) { this.WriteInstanceAnnotations(feed.InstanceAnnotations, currentFeedScope.InstanceAnnotationWriteTracker); } else { if (feed.InstanceAnnotations.Count > 0) { throw new ODataException(OData.Core.Strings.ODataJsonLightWriter_InstanceAnnotationNotSupportedOnExpandedFeed); } } }