コード例 #1
0
 /// <inheritdoc/>
 public void Enlist(PrepareCommandDelegate preparing)
 {
     Enlist(preparing, delegate(IDbCommand command)
     {
         command.ExecuteNonQuery();
     });
 }
コード例 #2
0
 /// <inheritdoc/>
 public void Enlist(PrepareCommandDelegate command,
   ExecuteCommandDelegate executor) {
   var enlisted = new EnlistedCommand(delegate(ITransactionContext context)
   {
     var cmd = command(context);
     if (cmd.Connection != connection_) {
       throw new ArgumentException(
         Resources.Resources.Arg_TransactionContext_Command_Connection);
     }
     return cmd;
   }, executor);
   commands_.Enqueue(enlisted);
 }
コード例 #3
0
        /// <inheritdoc/>
        public void Enlist(PrepareCommandDelegate command,
                           ExecuteCommandDelegate executor)
        {
            var enlisted = new EnlistedCommand(delegate(ITransactionContext context)
            {
                var cmd = command(context);
                if (cmd.Connection != connection_)
                {
                    throw new ArgumentException(
                        Resources.Resources.Arg_TransactionContext_Command_Connection);
                }
                return(cmd);
            }, executor);

            commands_.Enqueue(enlisted);
        }
コード例 #4
0
 /// <inheritdoc/>
 public void Enlist(PrepareCommandDelegate preparing,
   ExecuteCommandDelegate executor) {
   bool should_close_connection = false;
   try {
     if (connection_.State != ConnectionState.Open) {
       should_close_connection = true;
       connection_.Open();
     }
     executor(preparing(this));
   } catch (Exception e) {
     throw new ProviderException(e);
   } finally {
     if (should_close_connection) {
       connection_.Close();
     }
   }
 }
コード例 #5
0
        /// <inheritdoc/>
        public void Enlist(PrepareCommandDelegate preparing,
                           ExecuteCommandDelegate executor)
        {
            bool should_close_connection = false;

            try {
                if (connection_.State != ConnectionState.Open)
                {
                    should_close_connection = true;
                    connection_.Open();
                }
                executor(preparing(this));
            } catch (Exception e) {
                throw new ProviderException(e);
            } finally {
                if (should_close_connection)
                {
                    connection_.Close();
                }
            }
        }
コード例 #6
0
 public EnlistedCommand(PrepareCommandDelegate preparing,
   ExecuteCommandDelegate executor) {
   executor_ = executor;
   preparing_ = preparing;
 }
コード例 #7
0
 public EnlistedCommand(PrepareCommandDelegate preparing,
                        ExecuteCommandDelegate executor)
 {
     executor_  = executor;
     preparing_ = preparing;
 }
コード例 #8
0
 public void Enlist(PrepareCommandDelegate preparing) {
   Enlist(preparing, delegate(IDbCommand command) {
     command.ExecuteNonQuery();
   });
 }