public void Execute(SqlConnection connection, IScriptExecuteCallback callback) { if (runState != ScriptRunState.None) { throw new InvalidOperationException("Already Run"); } SqlCommand command = connection.CreateCommand(); command.CommandText = commandText; command.CommandType = CommandType.Text; command.CommandTimeout = 0; runState = ScriptRunState.Running; try { ExecuteCommand(command); runState = ScriptRunState.Succeeded; } catch (SqlException ex) { exception = ex; callback.Error(this, ex); runState = ScriptRunState.Failed; } }
public void Execute(SqlConnection connection, IScriptExecuteCallback callback) { if (runState != ScriptRunState.None) throw new InvalidOperationException("Already Run"); SqlCommand command = connection.CreateCommand(); command.CommandText = commandText; command.CommandType = CommandType.Text; command.CommandTimeout = 0; runState = ScriptRunState.Running; try { ExecuteCommand(command); runState = ScriptRunState.Succeeded; } catch(SqlException ex) { exception = ex; callback.Error(this, ex); runState = ScriptRunState.Failed; } }