• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ODataPayloadKind类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ODataPayloadKind的典型用法代码示例。如果您正苦于以下问题:C# ODataPayloadKind类的具体用法?C# ODataPayloadKind怎么用?C# ODataPayloadKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODataPayloadKind类属于命名空间,在下文中一共展示了ODataPayloadKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Parse

        /// <summary>
        /// Creates a context URI parser and parses the context URI read from the payload.
        /// </summary>
        /// <param name="model">The model to use when resolving the target of the URI.</param>
        /// <param name="contextUriFromPayload">The string value of the odata.metadata annotation read from the payload.</param>
        /// <param name="payloadKind">The payload kind we expect the context URI to conform to.</param>
        /// <param name="readerBehavior">Reader behavior if the caller is a reader, null if no reader behavior is available.</param>
        /// <param name="needParseFragment">Whether the fragment after $metadata should be parsed, if set to false, only MetadataDocumentUri is parsed.</param>
        /// <returns>The result from parsing the context URI.</returns>
        internal static ODataJsonLightContextUriParseResult Parse(
            IEdmModel model,
            string contextUriFromPayload,
            ODataPayloadKind payloadKind,
            ODataReaderBehavior readerBehavior,
            bool needParseFragment)
        {
            if (contextUriFromPayload == null)
            {
                throw new ODataException(ODataErrorStrings.ODataJsonLightContextUriParser_NullMetadataDocumentUri);
            }

            // Create an absolute URI from the payload string
            // TODO: Support relative context uri and resolving other relative uris
            Uri contextUri;
            if (!Uri.TryCreate(contextUriFromPayload, UriKind.Absolute, out contextUri))
            {
                throw new ODataException(ODataErrorStrings.ODataJsonLightContextUriParser_TopLevelContextUrlShouldBeAbsolute(contextUriFromPayload));
            }

            ODataJsonLightContextUriParser parser = new ODataJsonLightContextUriParser(model, contextUri);

            parser.TokenizeContextUri();
            if (needParseFragment)
            {
                parser.ParseContextUri(payloadKind, readerBehavior);
            }

            return parser.parseResult;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:39,代码来源:ODataJsonLightContextUriParser.cs


示例2: IsPayloadKindSupported

        internal static bool IsPayloadKindSupported(ODataPayloadKind payloadKind, bool inRequest)
        {
            switch (payloadKind)
            {
                case ODataPayloadKind.Feed:
                case ODataPayloadKind.EntityReferenceLinks:
                case ODataPayloadKind.Collection:
                case ODataPayloadKind.ServiceDocument:
                case ODataPayloadKind.MetadataDocument:
                case ODataPayloadKind.Error:
                    return !inRequest;

                case ODataPayloadKind.Entry:
                case ODataPayloadKind.Property:
                case ODataPayloadKind.EntityReferenceLink:
                case ODataPayloadKind.Value:
                case ODataPayloadKind.BinaryValue:
                case ODataPayloadKind.Batch:
                    return true;

                case ODataPayloadKind.Parameter:
                    return inRequest;
            }
            throw new ODataException(Strings.General_InternalError(InternalErrorCodes.ODataUtilsInternal_IsPayloadKindSupported_UnreachableCodePath));
        }
开发者ID:nickchal,项目名称:pash,代码行数:25,代码来源:ODataUtilsInternal.cs


示例3: Validate

 public static void Validate(ODataPayloadKind payloadKind, string parameterName)
 {
     if (!IsDefined(payloadKind))
     {
         throw Error.InvalidEnumArgument(parameterName, (int)payloadKind, typeof(ODataPayloadKind));
     }
 }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:7,代码来源:ODataPayloadKindHelper.cs


示例4: BuildContextUri

        /// <summary>
        /// Create context URL from ODataPayloadKind and ODataContextUrlInfo.
        /// should make the context uri correct for null primitive / null enum value / normal enum value
        /// ODataEnumValue is allowed to have null or arbitrary TypeName, but the output ContextUri must have correct type name.
        /// </summary>
        /// <param name="payloadKind">The ODataPayloadKind for the context URI.</param>
        /// <param name="contextInfo">The ODataContextUrlInfo to be used.</param>
        /// <returns>The generated context url.</returns>
        internal Uri BuildContextUri(ODataPayloadKind payloadKind, ODataContextUrlInfo contextInfo = null)
        {
            if (this.baseContextUrl == null)
            {
                return null;
            }

            Action<ODataContextUrlInfo> verifyAction;
            if (ValidationDictionary.TryGetValue(payloadKind, out verifyAction))
            {
                if (verifyAction != null && throwIfMissingInfo)
                {
                    Debug.Assert(contextInfo != null, "contextInfo != null");
                    verifyAction(contextInfo);
                }
            }
            else
            {
                throw new ODataException(Strings.ODataContextUriBuilder_UnsupportedPayloadKind(payloadKind.ToString()));
            }

            switch (payloadKind)
            {
                case ODataPayloadKind.ServiceDocument:
                    return this.baseContextUrl;
                case ODataPayloadKind.EntityReferenceLink:
                    return new Uri(this.baseContextUrl, ODataConstants.SingleEntityReferencesContextUrlSegment);
                case ODataPayloadKind.EntityReferenceLinks:
                    return new Uri(this.baseContextUrl, ODataConstants.CollectionOfEntityReferencesContextUrlSegment);
            }

            return CreateFromContextUrlInfo(contextInfo);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:41,代码来源:ODataContextUriBuilder.cs


示例5: ODataRawInputContext

        internal ODataRawInputContext(
            ODataFormat format,
            Stream messageStream,
            Encoding encoding,
            ODataMessageReaderSettings messageReaderSettings,
            bool readingResponse,
            bool synchronous,
            IEdmModel model,
            IODataUrlResolver urlResolver,
            ODataPayloadKind readerPayloadKind)
            : base(format, messageReaderSettings, readingResponse, synchronous, model, urlResolver)
        {
            Debug.Assert(messageStream != null, "stream != null");
            Debug.Assert(readerPayloadKind != ODataPayloadKind.Unsupported, "readerPayloadKind != ODataPayloadKind.Unsupported");

            ExceptionUtils.CheckArgumentNotNull(format, "format");
            ExceptionUtils.CheckArgumentNotNull(messageReaderSettings, "messageReaderSettings");

            try
            {
                this.stream = messageStream;
                this.encoding = encoding;
                this.readerPayloadKind = readerPayloadKind;
            }
            catch (Exception e)
            {
                // Dispose the message stream if we failed to create the input context.
                if (ExceptionUtils.IsCatchableExceptionType(e) && messageStream != null)
                {
                    messageStream.Dispose();
                }

                throw;
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:35,代码来源:ODataRawInputContext.cs


示例6: DetermineResponseFormat

        /// <summary>
        /// Determines the response format based on the results of content negotiation.
        /// </summary>
        /// <param name="payloadKind">The payload kind of the response.</param>
        /// <param name="acceptableMediaTypes">
        /// The acceptable media types used to determine the content type of the message.
        /// This is a comma separated list of content types as specified in RFC 2616, Section 14.1
        /// </param>
        /// <param name="acceptableCharSets">
        /// The acceptable charsets to use to the determine the encoding of the message.
        /// This is a comma separated list of charsets as specified in RFC 2616, Section 14.2
        /// </param>
        /// <returns>The format the response should use. </returns>
        internal ODataFormatWithParameters DetermineResponseFormat(ODataPayloadKind payloadKind, string acceptableMediaTypes, string acceptableCharSets)
        {
            Debug.Assert(payloadKind != ODataPayloadKind.Unsupported, "kind != ODataPayloadKind.Unsupported");

            ContentNegotiationResponseMessage responseMessage = new ContentNegotiationResponseMessage();

            ODataMessageWriterSettings settings = new ODataMessageWriterSettings { Version = this.responseVersion };
            settings.EnableAtomSupport();
            settings.SetContentType(acceptableMediaTypes, acceptableCharSets);

            try
            {
                using (ODataMessageWriter writer = new ODataMessageWriter(responseMessage, settings))
                {
                    ODataFormat format = ODataUtils.SetHeadersForPayload(writer, payloadKind);
                    return new ODataFormatWithParameters(format, responseMessage.ContentType);
                }
            }
            catch (ODataContentTypeException exception)
            {
                if (this.throwIfNoMatch)
                {
                    throw new DataServiceException(415, null, Microsoft.OData.Service.Strings.DataServiceException_UnsupportedMediaType, null, exception);
                }

                return null;
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:41,代码来源:ResponseContentTypeNegotiator.cs


示例7: GetMediaTypeFormats

        public override IEnumerable<ODataMediaTypeFormat> GetMediaTypeFormats(ODataPayloadKind payloadKind)
        {
            if (payloadKind == ODataPayloadKind.Property)
            {
                return mediaTypeFormats.Concat(base.GetMediaTypeFormats(payloadKind));
            }

            return base.GetMediaTypeFormats(payloadKind);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:VCardMediaTypeResolver.cs


示例8: ResponseBodyWriter

 internal ResponseBodyWriter(bool hasMoved, IDataService service, IEnumerator queryResults, RequestDescription requestDescription, IODataResponseMessage responseMessage, ODataPayloadKind payloadKind)
 {
     this.hasMoved = hasMoved;
     this.service = service;
     this.queryResults = queryResults;
     this.requestDescription = requestDescription;
     this.responseMessage = responseMessage;
     this.payloadKind = payloadKind;
     this.encoding = HttpProcessUtility.EncodingFromAcceptCharset(this.service.OperationContext.Host.RequestAcceptCharSet);
     if ((((payloadKind == ODataPayloadKind.Entry) || (payloadKind == ODataPayloadKind.Feed)) || ((payloadKind == ODataPayloadKind.Property) || (payloadKind == ODataPayloadKind.Collection))) || (((payloadKind == ODataPayloadKind.EntityReferenceLink) || (payloadKind == ODataPayloadKind.EntityReferenceLinks)) || (((payloadKind == ODataPayloadKind.Error) || (payloadKind == ODataPayloadKind.ServiceDocument)) || (payloadKind == ODataPayloadKind.Parameter))))
     {
         DataServiceHostWrapper host = service.OperationContext.Host;
         if (WebUtil.GetEffectiveMaxResponseVersion(service.Configuration.DataServiceBehavior.MaxProtocolVersion, host.RequestMaxVersion) > RequestDescription.Version2Dot0)
         {
             bool isEntityOrFeed = (payloadKind == ODataPayloadKind.Entry) || (payloadKind == ODataPayloadKind.Feed);
             if (WebUtil.ResponseMediaTypeWouldBeJsonLight(host.RequestAccept, isEntityOrFeed))
             {
                 requestDescription.VerifyAndRaiseResponseVersion(RequestDescription.Version3Dot0, service);
                 host.ResponseVersion = RequestDescription.Version3Dot0.ToString() + ";";
             }
         }
     }
     if (this.requestDescription.TargetKind == RequestTargetKind.MediaResource)
     {
         this.mediaResourceStream = service.StreamProvider.GetReadStream(this.queryResults.Current, RequestDescription.GetStreamProperty(this.requestDescription), this.service.OperationContext);
     }
     else if (payloadKind != ODataPayloadKind.BinaryValue)
     {
         string requestAcceptCharSet = this.service.OperationContext.Host.RequestAcceptCharSet;
         if (string.IsNullOrEmpty(requestAcceptCharSet) || (requestAcceptCharSet == "*"))
         {
             requestAcceptCharSet = "UTF-8";
         }
         if ((payloadKind == ODataPayloadKind.Value) && !string.IsNullOrEmpty(this.requestDescription.MimeType))
         {
             this.messageWriter = CreateMessageWriter(this.AbsoluteServiceUri, this.service, this.requestDescription.ActualResponseVersion, responseMessage, ODataFormat.RawValue);
         }
         else
         {
             this.messageWriter = CreateMessageWriter(this.AbsoluteServiceUri, this.service, this.requestDescription.ActualResponseVersion, responseMessage, this.service.OperationContext.Host.RequestAccept, requestAcceptCharSet);
         }
         try
         {
             this.contentFormat = ODataUtils.SetHeadersForPayload(this.messageWriter, payloadKind);
             if ((payloadKind == ODataPayloadKind.Value) && !string.IsNullOrEmpty(this.requestDescription.MimeType))
             {
                 responseMessage.SetHeader("Content-Type", this.requestDescription.MimeType);
             }
         }
         catch (ODataContentTypeException exception)
         {
             throw new DataServiceException(0x19f, null, System.Data.Services.Strings.DataServiceException_UnsupportedMediaType, null, exception);
         }
         string headerValue = this.requestDescription.ResponseVersion.ToString() + ";";
         responseMessage.SetHeader("DataServiceVersion", headerValue);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:57,代码来源:ResponseBodyWriter.cs


示例9: ODataEntryDeserializer

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataEntryDeserializer"/> class.
        /// </summary>
        /// <param name="edmType">The EDM type.</param>
        /// <param name="payloadKind">The kind of OData payload that this deserializer reads.</param>
        protected ODataEntryDeserializer(IEdmTypeReference edmType, ODataPayloadKind payloadKind)
            : base(payloadKind)
        {
            if (edmType == null)
            {
                throw Error.ArgumentNull("edmType");
            }

            EdmType = edmType;
        }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:15,代码来源:ODataEntryDeserializer.cs


示例10: ODataEntrySerializer

        protected ODataEntrySerializer(IEdmTypeReference edmType, ODataPayloadKind odataPayloadKind, ODataSerializerProvider serializerProvider)
            : this(edmType, odataPayloadKind)
        {
            if (serializerProvider == null)
            {
                throw Error.ArgumentNull("serializerProvider");
            }

            SerializerProvider = serializerProvider;
        }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:10,代码来源:ODataEntrySerializer.cs


示例11: MaterializeAtom

 internal MaterializeAtom(ResponseInfo responseInfo, QueryComponents queryComponents, ProjectionPlan plan, IODataResponseMessage responseMessage, ODataPayloadKind payloadKind)
 {
     Type type;
     this.responseInfo = responseInfo;
     this.elementType = queryComponents.LastSegmentType;
     this.MergeOptionValue = responseInfo.MergeOption;
     this.expectingPrimitiveValue = PrimitiveType.IsKnownNullableType(this.elementType);
     Type materializerType = GetTypeForMaterializer(this.expectingPrimitiveValue, this.elementType, responseInfo.MaxProtocolVersion, out type);
     this.materializer = ODataMaterializer.CreateMaterializerForMessage(responseMessage, responseInfo, materializerType, queryComponents, plan, payloadKind);
 }
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:MaterializeAtom.cs


示例12: ODataEdmTypeSerializer

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataEdmTypeSerializer"/> class.
        /// </summary>
        /// <param name="payloadKind">The kind of OData payload that this serializer generates.</param>
        /// <param name="serializerProvider">The <see cref="ODataSerializerProvider"/> to use to write inner objects.</param>
        protected ODataEdmTypeSerializer(ODataPayloadKind payloadKind, ODataSerializerProvider serializerProvider)
            : this(payloadKind)
        {
            if (serializerProvider == null)
            {
                throw Error.ArgumentNull("serializerProvider");
            }

            SerializerProvider = serializerProvider;
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:15,代码来源:ODataEdmTypeSerializer.cs


示例13: ODataEdmTypeDeserializer

        /// <summary>
        /// Initializes a new instance of the <see cref="ODataEdmTypeDeserializer"/> class.
        /// </summary>
        /// <param name="payloadKind">The kind of OData payload this deserializer handles.</param>
        /// <param name="deserializerProvider">The <see cref="ODataDeserializerProvider"/>.</param>
        protected ODataEdmTypeDeserializer(ODataPayloadKind payloadKind, ODataDeserializerProvider deserializerProvider)
            : this(payloadKind)
        {
            if (deserializerProvider == null)
            {
                throw Error.ArgumentNull("deserializerProvider");
            }

            DeserializerProvider = deserializerProvider;
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:15,代码来源:ODataEdmTypeDeserializer.cs


示例14: SetHeadersForPayload

        /// <summary>Sets the content-type and OData-Version headers on the message used by the message writer.</summary>
        /// <returns>The content-type and OData-Version headers on the message used by the message writer.</returns>
        /// <param name="messageWriter">The message writer to set the headers for.</param>
        /// <param name="payloadKind">The kind of payload to be written with the message writer.</param>
        /// <remarks>
        /// This method can be called if it is important to set all the message headers before calling any of the
        /// write methods on the <paramref name="messageWriter"/>.
        /// If it is sufficient to set the headers when the write methods on the <paramref name="messageWriter"/> 
        /// are called, you don't have to call this method and setting the headers will happen automatically.
        /// </remarks>
        public static ODataFormat SetHeadersForPayload(ODataMessageWriter messageWriter, ODataPayloadKind payloadKind)
        {
            ExceptionUtils.CheckArgumentNotNull(messageWriter, "messageWriter");

            if (payloadKind == ODataPayloadKind.Unsupported)
            {
                throw new ArgumentException(Strings.ODataMessageWriter_CannotSetHeadersWithInvalidPayloadKind(payloadKind), "payloadKind");
            }

            return messageWriter.SetHeaders(payloadKind);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:21,代码来源:ODataUtils.cs


示例15: VerifyResult

        /// <summary>
        /// Verifies that the result of the test (the message reader) is what the test expected.
        /// </summary>
        /// <param name="messageReader">The message reader which is the result of the test. This method should use it to read the results
        /// of the parsing and verify those.</param>
        /// <param name="payloadKind">The payload kind specified in the test descriptor.</param>
        /// <param name="testConfiguration">The test configuration to use.</param>
        public override void VerifyResult(
            ODataMessageReaderTestWrapper messageReader,
            ODataPayloadKind payloadKind,
            ReaderTestConfiguration testConfiguration)
        {
            // First compare the payload kind detection results.
            IEnumerable<ODataPayloadKindDetectionResult> actualDetectionResults = messageReader.DetectPayloadKind();
            this.VerifyPayloadKindDetectionResult(actualDetectionResults);

            // Then try to read the message as the detected kind if requested
            if (this.ReadDetectedPayloads)
            {
                bool firstResult = true;
                foreach (PayloadKindDetectionResult result in this.ExpectedDetectionResults)
                {
                    if (firstResult)
                    {
                        // For the first result use the existing message reader
                        firstResult = false;
                    }
                    else
                    {
                        // For all subsequent results we need to reset the test stream and create a new message reader
                        // over it.
                        this.TestMessage.Reset();
                        messageReader = TestReaderUtils.CreateMessageReader(this.TestMessage, result.Model, testConfiguration);

                        // Detect the payload kinds again and make sure we can also read the subsequent payload kinds
                        // immediately after detection.
                        actualDetectionResults = messageReader.DetectPayloadKind();
                        this.VerifyPayloadKindDetectionResult(actualDetectionResults);
                    }

                    TestExceptionUtils.ExpectedException(
                        this.settings.Assert,
                        () =>
                            {
                                using (messageReader)
                                {
                                    this.settings.MessageToObjectModelReader.ReadMessage(
                                        messageReader,
                                        result.PayloadKind,
                                        result.Model,
                                        new PayloadReaderTestDescriptor.ReaderMetadata(result.ExpectedType),
                                        /*expectedBatchPayload*/ null,
                                        testConfiguration);
                                }
                            },
                        result.ExpectedException,
                        this.settings.ExceptionVerifier);
                }
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:60,代码来源:PayloadKindDetectionTestExpectedResult.cs


示例16: GetMediaTypeFormats

        public override IEnumerable<ODataMediaTypeFormat> GetMediaTypeFormats(ODataPayloadKind payloadKind)
        {
            if (payloadKind == ODataPayloadKind.Property)
            {
                return VCardMediaTypeResolver.Instance.GetMediaTypeFormats(payloadKind);
            }
            else if (payloadKind == ODataPayloadKind.Entry || payloadKind == ODataPayloadKind.Feed)
            {
                return CsvMediaTypeResolver.Instance.GetMediaTypeFormats(payloadKind);
            }

            return base.GetMediaTypeFormats(payloadKind);
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:13,代码来源:CustomFormatter.cs


示例17: VerifyResult

        /// <summary>
        /// Verifies that the result of the test is what the test expected.
        /// </summary>
        /// <param name="stream">The stream after writing the message content. This method should use it 
        /// to read the message content and verify it.</param>
        /// <param name="payloadKind">The payload kind specified in the test descriptor.</param>
        /// <param name="testConfiguration">The test configuration to use.</param>
        public override void VerifyResult(
            TestMessage message,
            ODataPayloadKind payloadKind,
            WriterTestConfiguration testConfiguration,
            BaselineLogger logger)
        {
            // Get observed payload
#if !SILVERLIGHT
            var observed = TestWriterUtils.ReadToString(message);

            if (logger != null) logger.LogPayload(TestWriterUtils.BaseLineFixup(observed));
#endif
            // TODO: Handle SILVERLIGHT

        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:22,代码来源:PayloadWriterTestExpectedResults.cs


示例18: VerifyResult

        /// <summary>
        /// Verifies the result of the write-read.
        /// </summary>
        /// <param name="message">The test message is not used but is required to keep the method signature the same.</param>
        /// <param name="payloadKind">The payload kind is not used but is required to keep the method signature the same.</param>
        /// <param name="testConfiguration">The test configuration is used for some fixups.</param>
        public override void VerifyResult(TestMessage message, ODataPayloadKind payloadKind, WriterTestConfiguration testConfiguration, BaselineLogger logger=null)
        {
            //TODO: Use Logger to verify result, right now this change is only to unblock writer testcase checkin

            Debug.Assert(ObservedElement != null, "ObservedElement not provided");
            // Fixup the expected and get the content type
            ODataPayloadElement expected = this.ExpectedPayload.DeepCopy();
            ODataPayloadElement observed = this.ObservedElement.DeepCopy();

            observed.Accept(new RemoveTypeNameAnnotationFromComplexInCollection());
            expected.Accept(new ReorderProperties());
            expected.Accept(new RemoveComplexWithNoProperties());
            
            // Compare
            this.settings.PayloadElementComparer.Compare(expected, observed);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:22,代码来源:StreamingWriterTestExpectedResults.cs


示例19: IsDefined

 public static bool IsDefined(ODataPayloadKind payloadKind)
 {
     return payloadKind == ODataPayloadKind.Batch
         || payloadKind == ODataPayloadKind.BinaryValue
         || payloadKind == ODataPayloadKind.Collection
         || payloadKind == ODataPayloadKind.EntityReferenceLink
         || payloadKind == ODataPayloadKind.EntityReferenceLinks
         || payloadKind == ODataPayloadKind.Entry
         || payloadKind == ODataPayloadKind.Error
         || payloadKind == ODataPayloadKind.Feed
         || payloadKind == ODataPayloadKind.MetadataDocument
         || payloadKind == ODataPayloadKind.Parameter
         || payloadKind == ODataPayloadKind.Property
         || payloadKind == ODataPayloadKind.ServiceDocument
         || payloadKind == ODataPayloadKind.Value
         || payloadKind == ODataPayloadKind.Unsupported;
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:17,代码来源:ODataPayloadKindHelper.cs


示例20: VerifyResult

        /// <summary>
        /// Verifies that the result of the test (the message reader) is what the test expected.
        /// </summary>
        /// <param name="messageReader">The message reader which is the result of the test. This method should use it to read the results
        /// of the parsing and verify those.</param>
        /// <param name="payloadKind">The payload kind specified in the test descriptor.</param>
        /// <param name="testConfiguration">The test configuration to use.</param>
        public override void VerifyResult(
            ODataMessageReaderTestWrapper messageReader,
            ODataPayloadKind payloadKind, 
            ReaderTestConfiguration testConfiguration)
        {
            this.settings.Assert.IsTrue(payloadKind == ODataPayloadKind.MetadataDocument, "Only metadata payload kind is supported.");

            object metadata = this.settings.MessageToObjectModelReader.ReadMessage(
                messageReader, 
                payloadKind,
                /*payloadModel*/ null,
                PayloadReaderTestDescriptor.ReaderMetadata.None,
                /*expectedBatchPayload*/ null,
                testConfiguration);
            IEdmModel actualModel = metadata as IEdmModel;
            this.settings.Assert.IsTrue(metadata != null && actualModel != null, "Expected a non-null model to be read.");
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:24,代码来源:MetadataReaderTestExpectedResult.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ODataProperty类代码示例发布时间:2022-05-24
下一篇:
C# ODataPath类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap