本文整理汇总了C#中ODataClient.GetEntryAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ODataClient.GetEntryAsync方法的具体用法?C# ODataClient.GetEntryAsync怎么用?C# ODataClient.GetEntryAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODataClient
的用法示例。
在下文中一共展示了ODataClient.GetEntryAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEntrySubcollectionWithAnnotations
public async Task UpdateEntrySubcollectionWithAnnotations()
{
var clientSettings = new ODataClientSettings
{
BaseUri = _serviceUri,
IncludeAnnotationsInResults = true,
};
var client = new ODataClient(clientSettings);
var ship = await client.InsertEntryAsync("Transport/Ships", new Entry() { { "ShipName", "Test1" } }, true);
var key = new Entry() { { "TransportID", ship["TransportID"] } };
await client.UpdateEntryAsync("Transport/Ships", key, new Entry() { { "ShipName", "Test2" }, { FluentCommand.ResourceTypeLiteral, "Ships" } });
ship = await client.GetEntryAsync("Transport", key);
Assert.Equal("Test2", ship["ShipName"]);
}
示例2: GetEntryNonExistingIgnoreException
public async Task GetEntryNonExistingIgnoreException()
{
var settings = new ODataClientSettings
{
BaseUri = _serviceUri,
IgnoreResourceNotFoundException = true,
};
var client = new ODataClient(settings);
<<<<<<< HEAD:Simple.OData.Client.Tests.Net40/ClientTests.cs
var product = await client.GetEntryAsync("Products", new Entry() {{"ProductID", -1}});
Assert.Null(product);
}