本文整理汇总了C#中Microsoft.OData.Core.ODataMessageReaderSettings类的典型用法代码示例。如果您正苦于以下问题:C# ODataMessageReaderSettings类的具体用法?C# ODataMessageReaderSettings怎么用?C# ODataMessageReaderSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODataMessageReaderSettings类属于Microsoft.OData.Core命名空间,在下文中一共展示了ODataMessageReaderSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: Read_RoundTrips
public void Read_RoundTrips()
{
// Arrange
IEdmModel model = CreateModel();
var deserializer = new ODataEntityReferenceLinkDeserializer();
MockODataRequestMessage requestMessage = new MockODataRequestMessage();
ODataMessageWriterSettings settings = new ODataMessageWriterSettings()
{
ODataUri = new ODataUri { ServiceRoot = new Uri("http://any/") }
};
settings.SetContentType(ODataFormat.Json);
ODataMessageWriter messageWriter = new ODataMessageWriter(requestMessage, settings);
messageWriter.WriteEntityReferenceLink(new ODataEntityReferenceLink { Url = new Uri("http://localhost/samplelink") });
ODataMessageReaderSettings readSettings = new ODataMessageReaderSettings();
ODataMessageReader messageReader = new ODataMessageReader(new MockODataRequestMessage(requestMessage), readSettings, model);
ODataDeserializerContext context = new ODataDeserializerContext
{
Request = new HttpRequestMessage(),
Path = new ODataPath(new NavigationPathSegment(GetNavigationProperty(model)))
};
// Act
Uri uri = deserializer.Read(messageReader, typeof(Uri), context) as Uri;
// Assert
Assert.NotNull(uri);
Assert.Equal("http://localhost/samplelink", uri.AbsoluteUri);
}
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:30,代码来源:ODataEntityReferenceLinkDeserializerTests.cs
示例3: PropertyGettersAndSettersTest
public void PropertyGettersAndSettersTest()
{
Uri baseUri = new Uri("http://odata.org");
Func<ODataEntry, XmlReader, Uri, XmlReader> entryAtomXmlCustomizationCallback = (entry, reader, uri) => reader;
ODataMessageReaderSettings settings = new ODataMessageReaderSettings {
BaseUri = baseUri,
CheckCharacters = true,
DisablePrimitiveTypeConversion = true,
DisableMessageStreamDisposal = true,
EnableAtomMetadataReading = true,
UndeclaredPropertyBehaviorKinds = ODataUndeclaredPropertyBehaviorKinds.IgnoreUndeclaredValueProperty,
MaxProtocolVersion = ODataVersion.V4,
MessageQuotas = new ODataMessageQuotas {
MaxPartsPerBatch = 2,
MaxOperationsPerChangeset = 3,
MaxNestingDepth = 4,
MaxReceivedMessageSize = 5,
},
};
Assert.AreEqual(baseUri, settings.BaseUri, "The BaseUri was not correctly remembered.");
Assert.IsTrue(settings.CheckCharacters, "The CheckCharacters should be on when set.");
Assert.IsTrue(settings.DisablePrimitiveTypeConversion, "DisablePrimitiveTypeConversion was not correctly remembered.");
Assert.IsTrue(settings.DisableMessageStreamDisposal, "DisableMessageStreamDisposal was not correctly remembered.");
Assert.IsTrue(settings.EnableAtomMetadataReading, "EnableAtomMetadataReading was not correctly remembered.");
Assert.AreEqual(ODataUndeclaredPropertyBehaviorKinds.IgnoreUndeclaredValueProperty, settings.UndeclaredPropertyBehaviorKinds, "UndeclaredPropertyBehaviorKinds was not correctly remembered.");
Assert.AreEqual(ODataVersion.V4, settings.MaxProtocolVersion, "The MaxProtocolVersion was not correctly remembered.");
Assert.AreEqual(2, settings.MessageQuotas.MaxPartsPerBatch, "MaxPartsPerBatch should be 2");
Assert.AreEqual(3, settings.MessageQuotas.MaxOperationsPerChangeset, "MaxOperationsPerChangeset should be 3");
Assert.AreEqual(4, settings.MessageQuotas.MaxNestingDepth, "MaxNestingDepth should be 4");
Assert.AreEqual(5, settings.MessageQuotas.MaxReceivedMessageSize, "MaxMessageSize should be 5");
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:33,代码来源:ODataMessageReaderSettingsTests.cs
示例4: DetectPayloadKind
/// <summary>
/// Detects the payload kinds supported by this format for the specified message payload.
/// </summary>
/// <param name="messageInfo">The context information for the message.</param>
/// <param name="settings">Configuration settings of the OData reader.</param>
/// <returns>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
public override IEnumerable<ODataPayloadKind> DetectPayloadKind(
ODataMessageInfo messageInfo,
ODataMessageReaderSettings settings)
{
ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");
return DetectPayloadKindImplementation(messageInfo.MediaType);
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:ODataBatchFormat.cs
示例5: QueryEntries
/// <summary>
/// Specifically use to query single entry or multi entries(query with $expand)
/// </summary>
/// <param name="requestUri"></param>
/// <param name="mimeType"></param>
/// <returns></returns>
public List<ODataEntry> QueryEntries(string requestUri, string mimeType)
{
List<ODataEntry> entries = new List<ODataEntry>();
ODataMessageReaderSettings readerSettings = new ODataMessageReaderSettings() { BaseUri = baseUri };
var requestMessage = new HttpWebRequestMessage(new Uri(baseUri.AbsoluteUri + requestUri, UriKind.Absolute));
requestMessage.SetHeader("Accept", mimeType);
var responseMessage = requestMessage.GetResponse();
Assert.AreEqual(200, responseMessage.StatusCode);
if (!mimeType.Contains(MimeTypes.ODataParameterNoMetadata))
{
using (var messageReader = new ODataMessageReader(responseMessage, readerSettings, model))
{
var reader = messageReader.CreateODataEntryReader();
while (reader.Read())
{
if (reader.State == ODataReaderState.EntryEnd)
{
entries.Add(reader.Item as ODataEntry);
}
}
Assert.AreEqual(ODataReaderState.Completed, reader.State);
}
}
return entries;
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:34,代码来源:QueryOptionTestsHelper.cs
示例6: CreateReader
/// <summary>
/// Creates a new the reader for the given response message and settings.
/// </summary>
/// <param name="responseMessage">The response message.</param>
/// <param name="settings">The settings.</param>
/// <returns>Newly created message reader.</returns>
internal ODataMessageReader CreateReader(IODataResponseMessage responseMessage, ODataMessageReaderSettings settings)
{
Debug.Assert(responseMessage != null, "responseMessage != null");
Debug.Assert(settings != null, "settings != null");
this.responseInfo.Context.Format.ValidateCanReadResponseFormat(responseMessage);
return new ODataMessageReader(responseMessage, settings, this.responseInfo.TypeResolver.ReaderModel);
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:14,代码来源:ODataMessageReadingHelper.cs
示例7: ReaderTestConfiguration
/// <summary>
/// Constructor.
/// </summary>
/// <param name="format">The format used for the test.</param>
/// <param name="messageReaderSettings">The message reader settings used for the test.</param>
/// <param name="readerRequest">True if the test is reading a request. Otherwise false if it's reading a response.</param>
/// <param name="synchronous">True if the test should be ran using synchronous API. Otherwise false if it should be ran using asynchronous APIs.</param>
/// <param name="version">The OData protocol version to be used for reading the payload.</param>
public ReaderTestConfiguration(ODataFormat format, ODataMessageReaderSettings messageReaderSettings, bool IsRequest, bool synchronous,ODataVersion version = ODataVersion.V4)
:base(format, version, IsRequest, TestODataBehaviorKind.Default)
{
Debug.Assert(messageReaderSettings != null, "readerSettings != null");
this.MessageReaderSettings = messageReaderSettings;
this.Synchronous = synchronous;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:ReaderTestConfiguration.cs
示例8: ODataMessageReaderTestWrapper
/// <summary>
/// Constructor.
/// </summary>
/// <param name="messageReader">The message reader to wrap.</param>
/// <param name="testConfiguration">The test configuration to use.</param>
/// <remarks>
/// This constructor is used if not special checks against a test message should be performed.
/// Use the constructor overload that takes a <see cref="TestMessage"/> argument to enforce checks
/// around disposal of the message.
/// </remarks>
public ODataMessageReaderTestWrapper(ODataMessageReader messageReader, ODataMessageReaderSettings messageReaderSettings, ReaderTestConfiguration testConfiguration)
{
ExceptionUtilities.CheckArgumentNotNull(messageReader, "messageReader");
ExceptionUtilities.CheckArgumentNotNull(testConfiguration, "testConfiguration");
this.messageReader = messageReader;
this.messageReaderSettings = messageReaderSettings;
this.testConfiguration = testConfiguration;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:19,代码来源:ODataMessageReaderTestWrapper.cs
示例9: ReadStringPropertyUnderServerKnob
private static ODataProperty ReadStringPropertyUnderServerKnob(string payload)
{
MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(payload));
ODataMessageReaderSettings settings = new ODataMessageReaderSettings();
settings.EnableODataServerBehavior();
ODataAtomInputContext context = new ODataAtomInputContext(ODataFormat.Atom, memoryStream, Encoding.UTF8, settings, false /*readingResponse*/, true /*sync*/, EdmModel, null);
var deserializer = new ODataAtomPropertyAndValueDeserializer(context);
return deserializer.ReadTopLevelProperty(StringProperty, StringProperty.Type);
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:9,代码来源:ODataAtomPropertyAndValueDeserializerTests.cs
示例10: ProcessBatchAsync
/// <inheritdoc/>
public override async Task<HttpResponseMessage> ProcessBatchAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request == null)
{
throw Error.ArgumentNull("request");
}
ValidateRequest(request);
ODataMessageReaderSettings oDataReaderSettings = new ODataMessageReaderSettings
{
DisableMessageStreamDisposal = true,
MessageQuotas = MessageQuotas,
BaseUri = GetBaseUri(request)
};
ODataMessageReader reader = await request.Content.GetODataMessageReaderAsync(oDataReaderSettings, cancellationToken);
request.RegisterForDispose(reader);
ODataBatchReader batchReader = reader.CreateODataBatchReader();
List<ODataBatchResponseItem> responses = new List<ODataBatchResponseItem>();
Guid batchId = Guid.NewGuid();
List<IDisposable> resourcesToDispose = new List<IDisposable>();
try
{
while (batchReader.Read())
{
ODataBatchResponseItem responseItem = null;
if (batchReader.State == ODataBatchReaderState.ChangesetStart)
{
responseItem = await ExecuteChangeSetAsync(batchReader, batchId, request, cancellationToken);
}
else if (batchReader.State == ODataBatchReaderState.Operation)
{
responseItem = await ExecuteOperationAsync(batchReader, batchId, request, cancellationToken);
}
if (responseItem != null)
{
responses.Add(responseItem);
}
}
}
catch
{
foreach (ODataBatchResponseItem response in responses)
{
if (response != null)
{
response.Dispose();
}
}
throw;
}
return await CreateResponseMessageAsync(responses, request, cancellationToken);
}
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:57,代码来源:UnbufferedODataBatchHandler.cs
示例11: ODataAdapter
public ODataAdapter(ISession session, string protocolVersion, HttpResponseMessage response)
: this(session, protocolVersion)
{
var readerSettings = new ODataMessageReaderSettings
{
MessageQuotas = { MaxReceivedMessageSize = Int32.MaxValue }
};
using (var messageReader = new ODataMessageReader(new ODataResponseMessage(response), readerSettings))
{
Model = messageReader.ReadMetadataDocument();
}
}
开发者ID:tschnittgen,项目名称:Simple.OData.Client,代码行数:12,代码来源:ODataAdapter.cs
示例12: GetResponseAsync
public async Task<ODataResponse> GetResponseAsync(IODataResponseMessageAsync responseMessage, bool includeResourceTypeInEntryProperties = false)
{
var readerSettings = new ODataMessageReaderSettings();
readerSettings.MessageQuotas.MaxReceivedMessageSize = Int32.MaxValue;
using (var messageReader = new ODataMessageReader(responseMessage, readerSettings, _model))
{
var payloadKind = messageReader.DetectPayloadKind();
if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Error))
{
return ODataResponse.FromStatusCode(responseMessage.StatusCode);
}
else if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Value))
{
if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Collection))
{
throw new NotImplementedException();
}
else
{
var text = Utils.StreamToString(await responseMessage.GetStreamAsync());
return ODataResponse.FromFeed(new[] { new Dictionary<string, object>()
{
{ FluentCommand.ResultLiteral, text }
} });
}
}
else if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Batch))
{
return await ReadResponse(messageReader.CreateODataBatchReader(), includeResourceTypeInEntryProperties);
}
else if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Feed))
{
return ReadResponse(messageReader.CreateODataFeedReader(), includeResourceTypeInEntryProperties);
}
else if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Collection))
{
return ReadResponse(messageReader.CreateODataCollectionReader(), includeResourceTypeInEntryProperties);
}
else if (payloadKind.Any(x => x.PayloadKind == ODataPayloadKind.Property))
{
var property = messageReader.ReadProperty();
return ODataResponse.FromFeed(new[] { new Dictionary<string, object>()
{
{ property.Name ?? FluentCommand.ResultLiteral, GetPropertyValue(property.Value) }
} });
}
else
{
return ReadResponse(messageReader.CreateODataEntryReader(), includeResourceTypeInEntryProperties);
}
}
}
开发者ID:tschnittgen,项目名称:Simple.OData.Client,代码行数:52,代码来源:ResponseReader.cs
示例13: ParseBatchRequestsAsync
/// <summary>
/// Asynchronously parses the batch requests.
/// </summary>
/// <param name="request">The HTTP request that contains the batch requests.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The task object that represents this asynchronous operation.</returns>
public override async Task<IList<ODataBatchRequestItem>> ParseBatchRequestsAsync(
HttpRequestMessage request,
CancellationToken cancellationToken)
{
if (this.ApiFactory == null)
{
throw new InvalidOperationException(Resources.BatchHandlerRequiresApiContextFactory);
}
Ensure.NotNull(request, "request");
ODataMessageReaderSettings readerSettings = new ODataMessageReaderSettings
{
DisableMessageStreamDisposal = true,
MessageQuotas = MessageQuotas,
BaseUri = GetBaseUri(request)
};
ODataMessageReader reader =
await request.Content.GetODataMessageReaderAsync(readerSettings, cancellationToken);
request.RegisterForDispose(reader);
List<ODataBatchRequestItem> requests = new List<ODataBatchRequestItem>();
ODataBatchReader batchReader = reader.CreateODataBatchReader();
Guid batchId = Guid.NewGuid();
while (batchReader.Read())
{
if (batchReader.State == ODataBatchReaderState.ChangesetStart)
{
IList<HttpRequestMessage> changeSetRequests =
await batchReader.ReadChangeSetRequestAsync(batchId, cancellationToken);
foreach (HttpRequestMessage changeSetRequest in changeSetRequests)
{
changeSetRequest.CopyBatchRequestProperties(request);
}
requests.Add(this.CreateChangeSetRequestItem(changeSetRequests));
}
else if (batchReader.State == ODataBatchReaderState.Operation)
{
HttpRequestMessage operationRequest = await batchReader.ReadOperationRequestAsync(
batchId,
bufferContentStream: true,
cancellationToken: cancellationToken);
operationRequest.CopyBatchRequestProperties(request);
requests.Add(new OperationRequestItem(operationRequest));
}
}
return requests;
}
开发者ID:adestis-mh,项目名称:RESTier,代码行数:57,代码来源:RestierBatchHandler.cs
示例14: DisablePrimitiveTypeConversionTests
public DisablePrimitiveTypeConversionTests()
{
this.model = new EdmModel();
this.entityType = new EdmEntityType("FQ.NS", "EntityType", null, false, true);
this.entityType.AddStructuralProperty("String", EdmPrimitiveTypeKind.String);
this.entityType.AddStructuralProperty("Binary", EdmPrimitiveTypeKind.Binary);
this.model.AddElement(this.entityType);
var container = new EdmEntityContainer("FQ.NS", "Container");
this.model.AddElement(container);
container.AddEntitySet("Entities", this.entityType);
this.defaultSettings = new ODataMessageReaderSettings { BaseUri = new Uri("http://serviceRoot/"), EnableAtom = true };
this.settingsWithConversionDisabled = new ODataMessageReaderSettings(this.defaultSettings) { DisablePrimitiveTypeConversion = true, EnableAtom = true };
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:14,代码来源:DisablePrimitiveTypeConversionTests.cs
示例15: ODataPayloadKindDetectionInfo
/// <summary>
/// Constructor.
/// </summary>
/// <param name="contentType">The parsed content type as <see cref="ODataMediaType"/>.</param>
/// <param name="encoding">The encoding from the content type or the default encoding from <see cref="ODataMediaType" />.</param>
/// <param name="messageReaderSettings">The <see cref="ODataMessageReaderSettings"/> being used for reading the message.</param>
/// <param name="model">The <see cref="IEdmModel"/> for the payload.</param>
internal ODataPayloadKindDetectionInfo(
ODataMediaType contentType,
Encoding encoding,
ODataMessageReaderSettings messageReaderSettings,
IEdmModel model)
{
ExceptionUtils.CheckArgumentNotNull(contentType, "contentType");
ExceptionUtils.CheckArgumentNotNull(messageReaderSettings, "readerSettings");
this.contentType = contentType;
this.encoding = encoding;
this.messageReaderSettings = messageReaderSettings;
this.model = model;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:21,代码来源:ODataPayloadKindDetectionInfo.cs
示例16: ValidateMessageReaderSettings
/// <summary>
/// Validates that message reader settings are correct.
/// </summary>
/// <param name="messageReaderSettings">The message reader settings to validate.</param>
/// <param name="readingResponse">true if the settings were specified when reading a response, false when reading a request.</param>
internal static void ValidateMessageReaderSettings(ODataMessageReaderSettings messageReaderSettings, bool readingResponse)
{
Debug.Assert(messageReaderSettings != null, "messageReaderSettings != null");
if (messageReaderSettings.BaseUri != null && !messageReaderSettings.BaseUri.IsAbsoluteUri)
{
throw new ODataException(Strings.ReaderValidationUtils_MessageReaderSettingsBaseUriMustBeNullOrAbsolute(UriUtils.UriToString(messageReaderSettings.BaseUri)));
}
if (!readingResponse && messageReaderSettings.UndeclaredPropertyBehaviorKinds != ODataUndeclaredPropertyBehaviorKinds.None)
{
throw new ODataException(Strings.ReaderValidationUtils_UndeclaredPropertyBehaviorKindSpecifiedOnRequest);
}
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:19,代码来源:ReaderValidationUtils.cs
示例17: VCardInputContext
public VCardInputContext(ODataFormat format,
Stream messageStream,
ODataMediaType contentType,
Encoding encoding,
ODataMessageReaderSettings messageReaderSettings,
bool readingResponse,
bool synchronous,
IEdmModel model,
IODataUrlResolver urlResolver)
: base(format, messageReaderSettings, readingResponse, synchronous, model, urlResolver)
{
this.stream = messageStream;
this.reader = new VCardReader(new StreamReader(messageStream, encoding));
this.throwExceptionOnDuplicatedPropertyNames = false;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:15,代码来源:VCardInputContext.cs
示例18: DefaultValuesTest
public void DefaultValuesTest()
{
ODataMessageReaderSettings settings = new ODataMessageReaderSettings();
Assert.IsNull(settings.BaseUri, "BaseUri should be null by default.");
Assert.IsFalse(settings.CheckCharacters, "The CheckCharacters should be off by default.");
Assert.IsFalse(settings.DisablePrimitiveTypeConversion, "DisablePrimitiveTypeConversion should be false by default.");
Assert.IsFalse(settings.DisableMessageStreamDisposal, "DisableMessageStreamDisposal should be false by default.");
Assert.IsFalse(settings.EnableAtomMetadataReading, "EnableAtomMetadataReading should be false by default.");
Assert.AreEqual(ODataUndeclaredPropertyBehaviorKinds.None, settings.UndeclaredPropertyBehaviorKinds, "UndeclaredPropertyBehaviorKinds should be Default by default.");
Assert.AreEqual(ODataVersion.V4, settings.MaxProtocolVersion, "MaxProtocolVersion should be V3.");
Assert.AreEqual(100, settings.MessageQuotas.MaxPartsPerBatch, "MaxPartsPerBatch should be int.MaxValue.");
Assert.AreEqual(1000, settings.MessageQuotas.MaxOperationsPerChangeset, "MaxOperationsPerChangeset should be int.MaxValue.");
Assert.AreEqual(100, settings.MessageQuotas.MaxNestingDepth, "The MaxNestingDepth should be set to 100 by default.");
Assert.AreEqual(1024 * 1024, settings.MessageQuotas.MaxReceivedMessageSize, "The MaxMessageSize should be set to 1024 * 1024 by default.");
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:15,代码来源:ODataMessageReaderSettingsTests.cs
示例19: GetODataMessageReaderAsync
/// <summary>
/// Gets the <see cref="ODataMessageReader"/> for the <see cref="HttpContent"/> stream.
/// </summary>
/// <param name="content">The <see cref="HttpContent"/>.</param>
/// <param name="settings">The <see cref="ODataMessageReaderSettings"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>A task object that produces an <see cref="ODataMessageReader"/> when completed.</returns>
public static async Task<ODataMessageReader> GetODataMessageReaderAsync(this HttpContent content,
ODataMessageReaderSettings settings, CancellationToken cancellationToken)
{
if (content == null)
{
throw Error.ArgumentNull("content");
}
cancellationToken.ThrowIfCancellationRequested();
Stream contentStream = await content.ReadAsStreamAsync();
IODataRequestMessage oDataRequestMessage = new ODataMessageWrapper(contentStream, content.Headers);
ODataMessageReader oDataMessageReader = new ODataMessageReader(oDataRequestMessage, settings);
return oDataMessageReader;
}
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:22,代码来源:ODataHttpContentExtensions.cs
示例20: CreateInputContextAsync
public override System.Threading.Tasks.Task<ODataInputContext> CreateInputContextAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings)
{
return messageInfo.GetMessageStreamAsync()
.ContinueWith(
(streamTask) => (ODataInputContext) new VCardInputContext(
this,
streamTask.Result,
messageInfo.MediaType,
messageInfo.Encoding,
messageReaderSettings,
messageInfo.IsResponse,
/*sync*/ false,
messageInfo.Model,
messageInfo.UrlResolver),
TaskContinuationOptions.NotOnFaulted);
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:VCardFormat.cs
注:本文中的Microsoft.OData.Core.ODataMessageReaderSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论