Пример #1
0
        /// <summary>
        /// 运行删除数据库的核心方法
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        protected override void RunCore(IDbAccesser db)
        {
            //var mysqlInstance = new MySqlConnectionStringBuilder(db.Connection.ConnectionString);
            //MySqlConnection.ClearPool(db.Connection as MySqlConnection);

            using (var db2 = new DbAccesser(db.ConnectionSchema.ConnectionString, DbSetting.Provider_MySql))
            {
                db2.ExecuteText(string.Format("DROP DATABASE IF EXISTS {0};", this.Database));
            }
        }
Пример #2
0
        protected override void RunCore(IDbAccesser db)
        {
            //db.Connection.Close();

            //连接到 MASTER 数据库
            var master = new SqlConnectionStringBuilder(db.Connection.ConnectionString)
            {
                InitialCatalog = "MASTER"
            };

            //参考 EntityFramework SqlProviderServices.DbDeleteDatabase()
            SqlConnection.ClearPool(db.Connection as SqlConnection);

            using (var db2 = new DbAccesser(master.ConnectionString, DbSetting.Provider_SqlClient))
            {
                db2.ExecuteText(string.Format("DROP DATABASE [{0}]", this.Database));
            }
        }
Пример #3
0
 public int ExecuteText(string formatSql, params object[] parameters)
 {
     return(_dba.ExecuteText(formatSql, parameters));
 }