本文整理汇总了C#中ODataVersion.ToHeaderValue方法的典型用法代码示例。如果您正苦于以下问题:C# ODataVersion.ToHeaderValue方法的具体用法?C# ODataVersion.ToHeaderValue怎么用?C# ODataVersion.ToHeaderValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODataVersion
的用法示例。
在下文中一共展示了ODataVersion.ToHeaderValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResponse
//public void GetResponse(string uri, string format, ODataVersion version, ODataVersion maxVersion, IEdmModel model, string fileName)
//{
// HTTPClientRequestMessage message = new HTTPClientRequestMessage(uri);
// message.SetHeader("Accept", format);
// message.SetHeader("DataServiceVersion", version.ToHeaderValue());
// message.SetHeader("MaxDataServiceVersion", maxVersion.ToHeaderValue());
// string filePath = @".\out\" + fileName + ".txt";
// using (StreamWriter outputWriter = new StreamWriter(filePath))
// {
// this.writer = new IndentedTextWriter(outputWriter, " ");
// using (ODataMessageReader messageReader = new ODataMessageReader(message.GetResponse(), new ODataMessageReaderSettings(), model))
// {
// ODataReader reader = messageReader.CreateODataFeedReader();
// this.ReadAndOutputEntryOrFeed(reader);
// }
// }
//}
public ODataMessageReader GetResponse(string uri, string format, ODataVersion version, ODataVersion maxVersion, IEdmModel model)
{
HTTPClientRequestMessage message = new HTTPClientRequestMessage(uri);
message.SetHeader("Accept", format);
message.SetHeader("DataServiceVersion", version.ToHeaderValue());
message.SetHeader("MaxDataServiceVersion", maxVersion.ToHeaderValue());
return new ODataMessageReader(message.GetResponse(), new ODataMessageReaderSettings(), model);
}
示例2: BasicGetRequest
public void BasicGetRequest(string uri, string format, ODataVersion version, ODataVersion maxVersion, string filename)
{
HTTPClientRequestMessage message = new HTTPClientRequestMessage(uri);
message.SetHeader("Accept", format);
message.SetHeader("DataServiceVersion", version.ToHeaderValue());
message.SetHeader("MaxDataServiceVersion", maxVersion.ToHeaderValue());
WriteResponseToFile(message.GetResponse() as HTTPClientResponseMessage, filename);
}