/// <inheritdoc/> public void Enlist(PrepareCommandDelegate preparing) { Enlist(preparing, delegate(IDbCommand command) { command.ExecuteNonQuery(); }); }
/// <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); }
/// <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); }
/// <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(); } } }
/// <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(); } } }
public EnlistedCommand(PrepareCommandDelegate preparing, ExecuteCommandDelegate executor) { executor_ = executor; preparing_ = preparing; }
public EnlistedCommand(PrepareCommandDelegate preparing, ExecuteCommandDelegate executor) { executor_ = executor; preparing_ = preparing; }
public void Enlist(PrepareCommandDelegate preparing) { Enlist(preparing, delegate(IDbCommand command) { command.ExecuteNonQuery(); }); }