Ejemplo n.º 1
0
        /// <summary>
        /// Validates an <see cref="ODataFeed"/> to ensure all required information is specified and valid on the WriteEnd call.
        /// </summary>
        /// <param name="feed">The feed to validate.</param>
        /// <param name="writingRequest">Flag indicating whether the feed is written as part of a request or a response.</param>
        /// <param name="version">The version of the OData protocol used for checking.</param>
        internal static void ValidateFeedAtEnd(ODataFeed feed, bool writingRequest, ODataVersion version)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(feed != null, "feed != null");

            // Verify next link
            if (feed.NextPageLink != null)
            {
                // Check that NextPageLink is not set for requests
                if (writingRequest)
                {
                    throw new ODataException(Strings.WriterValidationUtils_NextPageLinkInRequest);
                }

                // Verify version requirements
                ODataVersionChecker.CheckNextLink(version);
            }

            // Verify Delta link, writingRequest is not verfied in order to be consistent with the behavior in Json.
            if (feed.DeltaLink != null)
            {
                // Verify version requirements
                ODataVersionChecker.CheckDeltaLink(version);
            }
        }
Ejemplo n.º 2
0
 private void VerifyEntityReferenceLinksHeaders(ODataEntityReferenceLinks links)
 {
     if (links.Count.HasValue)
     {
         ODataVersionChecker.CheckCount(this.settings.Version.Value);
     }
     if (links.NextPageLink != null)
     {
         ODataVersionChecker.CheckNextLink(this.settings.Version.Value);
     }
 }
Ejemplo n.º 3
0
 internal static void ValidateFeedAtEnd(ODataFeed feed, bool writingRequest, ODataVersion version)
 {
     if (feed.NextPageLink != null)
     {
         if (writingRequest)
         {
             throw new ODataException(Microsoft.Data.OData.Strings.WriterValidationUtils_NextPageLinkInRequest);
         }
         ODataVersionChecker.CheckNextLink(version);
     }
 }