Esempio n. 1
0
        public void run_the_task()
        {
            if (this.loggingHelper.HasLoggedErrors)
            {
                return;
            }

            Log4NetAppender.configure_without_console();
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(this);


            if (Restore && string.IsNullOrEmpty(RestoreFromPath))
            {
                throw new Exception(
                          "If you set Restore to true, you must specify a location for the database to be restored from. That property is RestoreFromPath in MSBuild.");
            }

            ApplicationConfiguraton.build_the_container(this);

            IRunner roundhouse_runner = new RoundhouseMigrationRunner(
                RepositoryPath,
                Container.get_an_instance_of <EnvironmentSet>(),
                Container.get_an_instance_of <KnownFolders>(),
                Container.get_an_instance_of <FileSystemAccess>(),
                Container.get_an_instance_of <DatabaseMigrator>(),
                Container.get_an_instance_of <VersionResolver>(),
                Silent,
                Drop,
                DoNotCreateDatabase,
                WithTransaction,
                this);

            roundhouse_runner.run();
        }
Esempio n. 2
0
        public static void Run(Logger log, string instanceName, string databaseType, string databaseName, bool dropDatabase, string scriptsLocation, string environmentName, bool useSimpleRecoveryMode)
        {
            _instanceName          = instanceName;
            _databaseType          = databaseType;
            _databaseName          = databaseName;
            _dropDatabase          = dropDatabase;
            _scriptsLocation       = scriptsLocation;
            _environmentName       = environmentName;
            _useSimpleRecoveryMode = useSimpleRecoveryMode;

            var loggers = new List <Logger>();

            loggers.Add(log);
            loggers.Add(new Log4NetLogger(_logger));

            var multiLogger = new MultipleLogger(loggers);
            var config      = GetRoundhousEConfiguration(multiLogger);

            //should be wrapped in his api
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(config);

            //should be wrapped in his api
            ApplicationConfiguraton.build_the_container(config);

            var runner = GetMigrationRunner(config);

            runner.run();
        }
Esempio n. 3
0
        public static ConfigurationPropertyHolder set_up_configuration_and_build_the_container(string[] args, Mode mode = Mode.Normal)
        {
            ConfigurationPropertyHolder configuration = new DefaultConfiguration();

            parse_arguments_and_set_up_configuration(configuration, args, mode);

            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);
            ApplicationConfiguraton.build_the_container(configuration);

            return(configuration);
        }
Esempio n. 4
0
        public static ConfigurationPropertyHolder set_up_configuration_and_build_the_container(string[] args)
        {
            ConfigurationPropertyHolder configuration = new ConsoleConfiguration();

            parse_arguments_and_set_up_configuration(configuration, args);
            if (configuration.Debug)
            {
                change_log_to_debug_level();
            }

            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);
            ApplicationConfiguraton.build_the_container(configuration);

            return(configuration);
        }
Esempio n. 5
0
        private RoundhouseMigrationRunner GetMigrationRunner()
        {
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(this.configuration);
            ApplicationConfiguraton.build_the_container(this.configuration);

            return(new RoundhouseMigrationRunner(
                       this.configuration.RepositoryPath,
                       Container.get_an_instance_of <environments.EnvironmentSet>(),
                       Container.get_an_instance_of <KnownFolders>(),
                       Container.get_an_instance_of <FileSystemAccess>(),
                       Container.get_an_instance_of <DatabaseMigrator>(),
                       Container.get_an_instance_of <VersionResolver>(),
                       this.configuration.Silent,
                       this.configuration.Drop,
                       this.configuration.DoNotCreateDatabase,
                       this.configuration.WithTransaction,
                       this.configuration));
        }
Esempio n. 6
0
        /// <summary>
        /// Call this method to run the migrator after you have set the options.
        /// </summary>
        public void Run()
        {
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);
            ApplicationConfiguraton.build_the_container(configuration);

            RoundhouseMigrationRunner migrator = new RoundhouseMigrationRunner(
                configuration.RepositoryPath,
                Container.get_an_instance_of <Environment>(),
                Container.get_an_instance_of <KnownFolders>(),
                Container.get_an_instance_of <FileSystemAccess>(),
                Container.get_an_instance_of <DatabaseMigrator>(),
                Container.get_an_instance_of <VersionResolver>(),
                configuration.Silent,
                configuration.Drop,
                configuration.DoNotCreateDatabase,
                configuration.WithTransaction,
                configuration.RecoveryModeSimple,
                configuration);

            migrator.run();
        }