当前位置: 首页>>代码示例>>C#>>正文


C# IODataResponseMessage.GetStream方法代码示例

本文整理汇总了C#中IODataResponseMessage.GetStream方法的典型用法代码示例。如果您正苦于以下问题:C# IODataResponseMessage.GetStream方法的具体用法?C# IODataResponseMessage.GetStream怎么用?C# IODataResponseMessage.GetStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IODataResponseMessage的用法示例。


在下文中一共展示了IODataResponseMessage.GetStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteEmptyResponse

 /// <summary>
 /// Write empty response and set the HttpStatusCode to 204 NoContent
 /// </summary>
 /// <param name="responseMessage"></param>
 public static void WriteEmptyResponse(IODataResponseMessage responseMessage, HttpStatusCode statusCode = HttpStatusCode.NoContent)
 {
     responseMessage.SetStatusCode(statusCode);
     responseMessage.SetHeader("OData-Version", "4.0");
     if (!(responseMessage is ODataBatchOperationResponseMessage))
     {
         using (responseMessage.GetStream())
         {
         }
     }
 }
开发者ID:vebin,项目名称:odata.net,代码行数:15,代码来源:ResponseWriter.cs

示例2: WriteAsyncPendingResponse

        /// <summary>
        /// Write empty response and set the HttpStatusCode to 202 Accepted
        /// </summary>
        /// <param name="responseMessage"></param>
        /// <param name="asyncToken"></param>
        public static void WriteAsyncPendingResponse(IODataResponseMessage responseMessage, string asyncToken)
        {
            responseMessage.SetStatusCode(HttpStatusCode.Accepted);
            responseMessage.SetHeader(ServiceConstants.HttpHeaders.DataServiceVersion, "4.0");
            Uri location = new Uri(ServiceConstants.ServiceBaseUri, string.Format("{0}?{1}={2}", ServiceConstants.ServicePath_Async, ServiceConstants.QueryOption_AsyncToken, asyncToken));
            responseMessage.SetHeader(ServiceConstants.HttpHeaders.Location, location.OriginalString);

            if (!(responseMessage is ODataBatchOperationResponseMessage))
            {
                using (responseMessage.GetStream())
                {
                }
            }
        }
开发者ID:vebin,项目名称:odata.net,代码行数:19,代码来源:ResponseWriter.cs

示例3: HandleOperationResponseData

        /// <summary>
        /// copy the response data
        /// </summary>
        /// <param name="response">response object</param>
        private void HandleOperationResponseData(IODataResponseMessage response)
        {
            Debug.Assert(response != null, "response != null");

            using (Stream stream = response.GetStream())
            {
                if (null != stream)
                {
                    // we need to check for whether the incoming stream was data or not. Hence we need to copy it to a temporary memory stream
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        if (WebUtil.CopyStream(stream, memoryStream, ref this.buildBatchBuffer) != 0)
                        {
                            // set the memory stream position to zero again.
                            memoryStream.Position = 0;
                            this.HandleOperationResponseData(response, memoryStream);
                        }
                        else
                        {
                            this.HandleOperationResponseData(response, null);
                        }
                    }
                }
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:29,代码来源:SaveResult.cs


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