async/await
私は、C# 5.0 の新しいキーワードに基づいて特定のアプリケーション (サービス) を構築しました。それを使用WebApi
して、Oracle db から呼び出しを作成しましたが、Http_Request
テストしましたが、実際には正しくないと感じましたasync
。これ?
public async Task<WebResponse> Post(Customer customer)
{
if (!customer.ReturnSuccess()) throw new ArgumentNullException("customer");
_logger.Info(string.Format("Customer validation request - date = {0} \n {1}\t\n", DateTime.Now, customer));
try
{
return await Task.Factory.StartNew(() => _service.EvaluateCustomer(customer));
}
catch (Exception e)
{
_logger.ErrorException("Error", e);
}
return null;
}