//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

namespace CommonHelpers {

//**************************************************************************************************
static partial class HSqlCommandDispose {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static async Task<SqlDataReader> ExecuteReader_A(SqlCommand command) =>
   await ExecuteReader_A( command, CommandBehavior.Default ).ConfigureAwait(false);

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static async Task<SqlDataReader> ExecuteReader_A( SqlCommand command,
                                                         [HOptional] CommandBehavior behaviour )
{
   using ( HArgChecking.VerifyNotNull( command ) )
      return await command.ExecuteReaderAsync( behaviour ).ConfigureAwait(false);
}

//==================================================================================================

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static async Task<int> ExecuteNonQuery_A(SqlCommand command)
{
   using ( HArgChecking.VerifyNotNull( command ) )
      return await command.ExecuteNonQueryAsync().ConfigureAwait(false);
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HSqlCommandDispose
//**************************************************************************************************

} // CommonHelpers
