Esempio n. 1
0
        public async Task SetupAlreadyExists()
        {
            var TestObject = new SQLServerSchemaGenerator(Canister.Builder.Bootstrapper.ResolveAll <ISourceBuilder>(), Canister.Builder.Bootstrapper.ResolveAll <ICommandBuilder>(), Canister.Builder.Bootstrapper.Resolve <IConfiguration>(), Helper, Helper);
            var Source     = await TestObject.GetSourceStructureAsync(new Connection(Configuration, SqlClientFactory.Instance, "", "Default")).ConfigureAwait(false);

            Source.Tables[0].AddColumn <int>("Column B", System.Data.DbType.Int32);
            await TestObject.SetupAsync(Source, new Connection(Configuration, SqlClientFactory.Instance, "", "Default")).ConfigureAwait(false);
        }
Esempio n. 2
0
        public async Task SetupDoesntExists()
        {
            var TestObject = new SQLServerSchemaGenerator(Canister.Builder.Bootstrapper.ResolveAll <ISourceBuilder>(), Canister.Builder.Bootstrapper.ResolveAll <ICommandBuilder>(), Canister.Builder.Bootstrapper.Resolve <IConfiguration>(), Helper, Helper);
            var Source     = await TestObject.GetSourceStructureAsync(new Connection(Configuration, SqlClientFactory.Instance, "", "Default")).ConfigureAwait(false);

            Source.Tables[0].AddColumn <int>("Column B", System.Data.DbType.Int32);
            Source.Name = "TestDatabase2";
            await TestObject.SetupAsync(Source, new Connection(Configuration, SqlClientFactory.Instance, "", "DefaultNew")).ConfigureAwait(false);

            await TestObject.SourceExistsAsync("TestDatabase2", new Connection(Configuration, SqlClientFactory.Instance, "", "DefaultNew")).ConfigureAwait(false);

            using var TempConnection        = SqlClientFactory.Instance.CreateConnection();
            TempConnection.ConnectionString = MasterString;
            using var TempCommand           = TempConnection.CreateCommand();
            try
            {
                TempCommand.CommandText = "ALTER DATABASE TestDatabase2 SET OFFLINE WITH ROLLBACK IMMEDIATE\r\nALTER DATABASE TestDatabase2 SET ONLINE\r\nDROP DATABASE TestDatabase2";
                TempCommand.Open();
                TempCommand.ExecuteNonQuery();
            }
            finally { TempCommand.Close(); }
        }