Example #1
0
        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();
                }
            }
        }
Example #2
0
        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();
            }
        }