/// <summary>
        /// Validates that the parsed context URI from the payload is consistent with the expected
        /// entity set and entity type when reading a feed or entry payload.
        /// </summary>
        /// <param name="contextUriParseResult">The parse result of the context URI from the payload.</param>
        /// <param name="scope">The top-level scope representing the reader state.</param>
        /// <param name="updateScope">Whether to update scope when validating.</param>
        internal static void ValidateFeedOrEntryContextUri(ODataJsonLightContextUriParseResult contextUriParseResult, ODataReaderCore.Scope scope, bool updateScope)
        {
            if (contextUriParseResult.EdmType is IEdmCollectionType)
            {
                ValidateFeedContextUri(contextUriParseResult, scope, updateScope);
                return;
            }

            Debug.Assert(contextUriParseResult != null, "contextUriParseResult != null");
            Debug.Assert(
                contextUriParseResult.NavigationSource != null || contextUriParseResult.EdmType != null,
                "contextUriParseResult.EntitySet != null || contextUriParseResult.EdmType != null");
            Debug.Assert(contextUriParseResult.EdmType is IEdmEntityType, "contextUriParseResult.StructuredType is IEdmEntityType");

            // Set the navigation source name or make sure the navigation source names match.
            if (scope.NavigationSource == null)
            {
                if (updateScope)
                {
                    scope.NavigationSource = contextUriParseResult.NavigationSource;
                }
            }
            else if (contextUriParseResult.NavigationSource != null && string.CompareOrdinal(scope.NavigationSource.FullNavigationSourceName(), contextUriParseResult.NavigationSource.FullNavigationSourceName()) != 0)
            {
                throw new ODataException(Strings.ReaderValidationUtils_ContextUriValidationInvalidExpectedEntitySet(
                    UriUtils.UriToString(contextUriParseResult.ContextUri),
                    contextUriParseResult.NavigationSource.FullNavigationSourceName(),
                    scope.NavigationSource.FullNavigationSourceName()));
            }

            // Set the entity type or make sure the entity types are assignable.
            IEdmEntityType payloadEntityType = (IEdmEntityType)contextUriParseResult.EdmType;
            if (scope.EntityType == null)
            {
                if (updateScope)
                {
                    scope.EntityType = payloadEntityType;
                }
            }
            else if (scope.EntityType.IsAssignableFrom(payloadEntityType))
            {
                if (updateScope)
                {
                    scope.EntityType = payloadEntityType;
                }
            }
            else if (!payloadEntityType.IsAssignableFrom(scope.EntityType))
            {
                throw new ODataException(Strings.ReaderValidationUtils_ContextUriValidationInvalidExpectedEntityType(
                    UriUtils.UriToString(contextUriParseResult.ContextUri),
                    contextUriParseResult.EdmType.ODataFullName(),
                    scope.EntityType.FullName()));
            }
        }
 /// <summary>
 /// The validate feed context uri.
 /// </summary>
 /// <param name="contextUriParseResult">
 /// The context uri parse result.
 /// </param>
 /// <param name="scope">
 /// The scope.
 /// </param>
 /// <param name="updateScope">
 /// The update scope.
 /// </param>
 private static void ValidateFeedContextUri(ODataJsonLightContextUriParseResult contextUriParseResult, ODataReaderCore.Scope scope, bool updateScope)
 {
     // TODO: add validation logic for a feed context uri
 }