1
我有一個長時間運行的查詢,當我嘗試用CancellationToken中止查詢什麼都沒有發生。我如何取消ExecuteReaderAsync與CancellationToken
using (var cmd = connection.CreateCommand())
{
cmd.CommandText = contrat.StoredProcedureName;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 2000;
AddParameters(cmd, contrat.ParametresCommand);
using (var reader = await cmd.ExecuteReaderAsync(Token))
{
return contrat.ConvertAsync(reader);
}
}
我已經取消了我的令牌,它在客戶端的canceld,但它不是在服務器端cancled –