public void DMDBT_DropDatabase()
        {
            //以下代码不能运行,会提示数据库正在被使用
            using (var context = new DbMigrationContext(DbSetting.FindOrCreate("Test_TestingDataBase")))
            {
                //context.HistoryRepository = new DbHistoryRepository();
                context.RunDataLossOperation = DataLossOperation.All;

                if (context.DatabaseExists() && !(context.DbVersionProvider is EmbadedDbVersionProvider))
                {
                    //context.DeleteDatabase();
                    var database = new DestinationDatabase("Test_TestingDataBase")
                    {
                        Removed = true
                    };
                    context.MigrateTo(database);

                    //历史记录
                    var histories = context.GetHistories();
                    Assert.IsTrue(histories[0] is DropDatabase);

                    //数据库结构
                    Assert.IsTrue(!context.DatabaseExists());
                }

                context.ResetHistory();
            }
        }
        public void DMDBT_CreateDatabase()
        {
            using (var context = new DbMigrationContext(DbSetting.FindOrCreate("Test_TestingDataBase")))
            {
                //context.HistoryRepository = new HistoryRepository();
                context.RunDataLossOperation = DataLossOperation.All;

                if (!context.DatabaseExists())
                {
                    var destination = new DestinationDatabase("Test_TestingDataBase");
                    var tmpTable    = new Table("TestingTable", destination);
                    tmpTable.AddColumn("Id", DbType.Int32, isPrimaryKey: true);
                    tmpTable.AddColumn("Name", DbType.String);
                    destination.Tables.Add(tmpTable);

                    context.MigrateTo(destination);

                    //历史记录
                    //var histories = context.GetHistories();
                    //Assert.IsTrue(histories.Count == 3);
                    //Assert.IsTrue(histories[2] is CreateDatabase);

                    //数据库结构
                    Assert.IsTrue(context.DatabaseExists());
                }
            }
        }