Oracle-klienten tilsidesætter ikke de asynkroniserede versioner af metoderne. De bruger standard DbCommand
implementeringer, der kalder de ikke-asynkroniserede versioner af metoderne.
For eksempel implementeringen af ExecuteNonQueryAsync
er:
// System.Data.Common.DbCommand
public virtual Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return ADP.CreatedTaskWithCancellation<int>();
}
CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
if (cancellationToken.CanBeCanceled)
{
cancellationTokenRegistration = cancellationToken.Register(new Action(this.CancelIgnoreFailure));
}
Task<int> result;
try
{
result = Task.FromResult<int>(this.ExecuteNonQuery());
}
catch (Exception ex)
{
cancellationTokenRegistration.Dispose();
result = ADP.CreatedTaskWithException<int>(ex);
}
return result;
}
Som du kan se, kalder den simpelthen ExecuteNonQuery
under motorhjelmen (den ingen parameter overbelastning af ExecuteNonQueryAsync
kalder denne version af metoden).