Exemple #1
0
        public static async Task <DatabaseFixture> CreateAsync()
        {
            var deployer = new SqlProjectDeployer("Database/WebApiBoilerplate.Database.sqlproj");

            var database = await deployer.RecreateToAsync(
                new SqlConnection(TestDatabaseConnectionString.ServerConnectionString),
                TestDatabaseConnectionString.DatabaseName);

            //setup our DI
            var services = new ServiceCollection();

            services.AddNHibernateDbContext <WebApiBorilerplateDbContext>(config =>
            {
                config.Connection(db =>
                {
                    db.ConnectionString = TestDatabaseConnectionString.DatabaseConnectionString;
                    db.Dialect <MsSql2012Dialect>();
                    db.Driver <Sql2008ClientDriver>();
                    db.ConnectionProvider <DriverConnectionProvider>();

                    db.LogSqlInConsole = false;
                });
            });

            services.AddCoreServices();

            return(new DatabaseFixture(database, services.BuildServiceProvider()));;
        }
Exemple #2
0
        public async static Task <int> Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Usage: sqldeploy <projectFile> <connectionString> <dbName>");
                return(5);
            }

            var deployer = new SqlProjectDeployer(args[0]);
            await deployer.RecreateToAsync(new SqlConnection(args[1]), databaseName : args[2]);

            return(0);
        }
Exemple #3
0
        public Task <ISqlDatabase> CreateDeployDb1()
        {
            var deployer = new SqlProjectDeployer("db-1/DB1.sqlproj");

            return(deployer.RecreateToAsync(new SqlConnection(SqlServerConnectionString.Current), databaseName: "DB1"));
        }