public virtual void ExecuteScripts() { var connection = ConnectionManager.GetConnection(); using (new OpenConnectionGuard(ConnectionManager)) { foreach (string ddlText in ScriptManager.ScriptContents) { DbCommand command = connection.CreateCommand(); command.CommandText = ddlText; command.ExecuteNonQuery(); } } }
public virtual void ExecuteScripts() { var connection = ConnectionManager.GetConnection(); if (connection.State != ConnectionState.Open) { connection.Open(); } foreach (string ddlText in ScriptManager.ScriptContents) { IDbCommand command = connection.CreateCommand(); command.CommandText = ddlText; command.ExecuteNonQuery(); } if (connection.State != ConnectionState.Closed) { connection.Close(); } }