public async Task<list<OrderEntity>> GetOrdersOfCustomersFromCountryAsync(string country)
{
using(var adapter = new DataAccessAdapter())
{
// use azure transient error recovery strategy using max of 5 retries, with a maximum delay
// of 10 seconds between tries, using 2 seconds as base interval and a linear delay increase.
var transientStrategy = new SqlAzureRecoveryStrategy(5, new RecoveryDelay(
new TimeSpan(0, 0, 10), 2,
RecoveryStrategyDelayType.Linear));
adapter.ActiveRecoveryStrategy = transientStrategy;
var metaData = new LinqMetaData(adapter);
var q = from o in metaData.Order
where o.Customer.Country == country
orderby o.OrderId ascending
select o;
return await q.ToListAsync();
}
}
Example of an async method using a transient error recovery strategy in a linq query.