public void Execute(SqlConnection c, SqlTransaction tran, int commandTimeoutSecs) { _log.DebugFormat("Executing Table Builder"); var sql = GenerateCommand(); if (!string.IsNullOrEmpty(sql)) { using (SqlCommand cmd = c.CreateCommand()) { if (tran != null) { cmd.Transaction = tran; } // give caller chance to view and modify sql... var args = new ExecuteEventArgs { SqlStatements = sql }; OnBeforeExecute(args); cmd.CommandTimeout = commandTimeoutSecs; cmd.CommandText = args.SqlStatements; cmd.ExecuteNonQuery(); } } else { _log.Warn("Table Builder has no tables!"); } }
private void OnBeforeExecute(ExecuteEventArgs e) { BeforeExecute?.Invoke(this, e); }