0

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;
}
4

2 に答える 2