//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// DataHelpers.SQL satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Threading.Tasks;
using u = user_rtx;

namespace DataHelpers.SQL {

/// <summary>
/// </summary>
[h_db_orm_type]
public static class HDbAccessPerformer {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static async Task Do_A( Func<Task> bodyA )
{
   using ( new HDbQuery() ) {
      await HDbQuery.Connect_A().ConfigureAwait(false);
      await bodyA().ConfigureAwait(false); }
}

public static async Task<R> Do_A<R>( Func<Task<R>> bodyA )
{
   using ( new HDbQuery() ) {
      await HDbQuery.Connect_A().ConfigureAwait(false);
      return await bodyA().ConfigureAwait(false); }
}

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

public static async Task Do_A( string procedureName, Func<Task> bodyA )
{
   using ( new HSP(procedureName) ) {
      await HDbQuery.Connect_A().ConfigureAwait(false);
      await bodyA().ConfigureAwait(false); }
}

public static async Task<R> Do_A<R>( string procedureName, Func<Task<R>> bodyA )
{
   using ( new HSP(procedureName) ) {
      await HDbQuery.Connect_A().ConfigureAwait(false);
      return await bodyA().ConfigureAwait(false); }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HDbAccessPerformer

} // DataHelpers.SQL
