catch (SqlException ex) when (cancellationToken.IsCancellationRequested && ex.Number == 0 && ex.State == 0 && ex.Class == 11)
{
    throw new OperationCanceledException(cancellationToken);
}