Exemple #1
0
        private void ReadFeedProperty(ODataFeed feed, string propertyName, bool isExpandedLinkContent)
        {
            switch (ODataJsonReaderUtils.DetermineFeedPropertyKind(propertyName))
            {
            case ODataJsonReaderUtils.FeedPropertyKind.Unsupported:
                base.JsonReader.SkipValue();
                return;

            case ODataJsonReaderUtils.FeedPropertyKind.Count:
            {
                if ((!base.ReadingResponse || (base.Version < ODataVersion.V2)) || isExpandedLinkContent)
                {
                    base.JsonReader.SkipValue();
                    return;
                }
                string propertyValue = base.JsonReader.ReadStringValue("__count");
                ODataJsonReaderUtils.ValidateFeedProperty(propertyValue, "__count");
                long num = (long)ODataJsonReaderUtils.ConvertValue(propertyValue, EdmCoreModel.Instance.GetInt64(false), base.MessageReaderSettings, base.Version, true);
                feed.Count = new long?(num);
                return;
            }

            case ODataJsonReaderUtils.FeedPropertyKind.Results:
                throw new ODataException(Microsoft.Data.OData.Strings.ODataJsonEntryAndFeedDeserializer_MultipleFeedResultsPropertiesFound);

            case ODataJsonReaderUtils.FeedPropertyKind.NextPageLink:
            {
                if (!base.ReadingResponse || (base.Version < ODataVersion.V2))
                {
                    base.JsonReader.SkipValue();
                    return;
                }
                string str2 = base.JsonReader.ReadStringValue("__next");
                ODataJsonReaderUtils.ValidateFeedProperty(str2, "__next");
                feed.NextPageLink = base.ProcessUriFromPayload(str2);
                return;
            }
            }
            throw new ODataException(Microsoft.Data.OData.Strings.General_InternalError(InternalErrorCodes.ODataJsonEntryAndFeedDeserializer_ReadFeedProperty));
        }