DALs.Sql/SqlClient.cs
/// <summary>
/// command as an asynchronous operation.
/// </summary>
/// <param name="config">The configuration.</param>
/// <returns>Task&lt;System.Int32&gt;.</returns>
command as an asynchronous operation.
command as an asynchronous operation .
public virtual async Task<int> CommandAsync(SqlConfiguration config)
        {
            int result = -1;
            using (IDbConnection connection = init.DbConnection(config.ConnectionString))
            {
                try
                {
                    using (IDbCommand command = init.DbCommand(config.StoredProcedures.First()))
                    {
                        command.Connection = connection;
                        command.LoadParameters(config.SqlParameters as List<SqlParameter>);
                        connection.Open();
                        result = await command.ExecuteNonQueryAsync();
                    }
                }
                catch (Exception e)
                {
                    Trace.TraceError(e.StackTrace);
                }
                finally
                {
                    connection.ForceClose();
                }
            }
            return result;
        }
public virtual async Task < int > CommandAsync ( SqlConfiguration config ) { int result = - 1 ; using ( IDbConnection connection = init . DbConnection ( config . ConnectionString ) ) { try { using ( IDbCommand command = init . DbCommand ( config . StoredProcedures . First ( ) ) ) { command . Connection = connection ; command . LoadParameters ( config . SqlParameters as List < SqlParameter > ) ; connection . Open ( ) ; result = await command . ExecuteNonQueryAsync ( ) ; } } catch ( Exception e ) { Trace . TraceError ( e . StackTrace ) ; } finally { connection . ForceClose ( ) ; } } return result ; }
command as an asynchronous operation.
command as an asynchronous operation .
None
config
SqlConfiguration
None