Example #1
0
        public MigrationRunner(IAssemblyCollection assemblies, IRunnerContext runnerContext, IMigrationProcessor processor)
        {
            _migrationAssemblies  = assemblies;
            _announcer            = runnerContext.Announcer;
            Processor             = processor;
            _stopWatch            = runnerContext.StopWatch;
            ApplicationContext    = runnerContext.ApplicationContext;
            TransactionPerSession = runnerContext.TransactionPerSession;

            SilentlyFail     = false;
            CaughtExceptions = null;

            Conventions = new MigrationConventions();
            if (!string.IsNullOrEmpty(runnerContext.WorkingDirectory))
            {
                Conventions.GetWorkingDirectory = () => runnerContext.WorkingDirectory;
            }

            _migrationScopeHandler = new MigrationScopeHandler(Processor);
            _migrationValidator    = new MigrationValidator(_announcer, Conventions);
            MigrationLoader        = new DefaultMigrationInformationLoader(Conventions, _migrationAssemblies, runnerContext.Namespace, runnerContext.NestedNamespaces, runnerContext.Tags);
            ProfileLoader          = new ProfileLoader(runnerContext, this, Conventions);
            MaintenanceLoader      = new MaintenanceLoader(_migrationAssemblies, runnerContext.Tags, Conventions);

            if (runnerContext.NoConnection)
            {
                VersionLoader = new ConnectionlessVersionLoader(this, _migrationAssemblies, Conventions, runnerContext.StartVersion, runnerContext.Version);
            }
            else
            {
                VersionLoader = new VersionLoader(this, _migrationAssemblies, Conventions);
            }
        }
        public MigrationRunner(IAssemblyCollection assemblies, IRunnerContext runnerContext, IMigrationProcessor processor)
        {
            _migrationAssemblies = assemblies;
            _announcer = runnerContext.Announcer;
            Processor = processor;
            _stopWatch = runnerContext.StopWatch;
            RunnerContext = runnerContext;

            SilentlyFail = false;
            CaughtExceptions = null;

            Conventions = new MigrationConventions();
            if (!string.IsNullOrEmpty(runnerContext.WorkingDirectory))
                Conventions.GetWorkingDirectory = () => runnerContext.WorkingDirectory;

            _migrationScopeHandler = new MigrationScopeHandler(Processor);
            _migrationValidator = new MigrationValidator(_announcer, Conventions);
            MigrationLoader = new DefaultMigrationInformationLoader(Conventions, _migrationAssemblies, runnerContext.Namespace, runnerContext.NestedNamespaces, runnerContext.Tags);
            ProfileLoader = new ProfileLoader(runnerContext, this, Conventions);
            MaintenanceLoader = new MaintenanceLoader(_migrationAssemblies, runnerContext.Tags, Conventions);

            if (runnerContext.NoConnection){
                VersionLoader = new ConnectionlessVersionLoader(this, _migrationAssemblies, Conventions, runnerContext.StartVersion, runnerContext.Version);
            }
            else{
                VersionLoader = new VersionLoader(this, _migrationAssemblies, Conventions);
            }
        }
Example #3
0
        public MigrationRunner(
            IAssemblyCollection assemblies, IRunnerContext runnerContext,
            IMigrationProcessor processor, IVersionTableMetaData versionTableMetaData,
            IMigrationRunnerConventions migrationRunnerConventions, IConventionSet conventionSet)
        {
            _migrationAssemblies = assemblies;
            _announcer           = runnerContext.Announcer;
            Processor            = processor;
            _stopWatch           = runnerContext.StopWatch;
            RunnerContext        = runnerContext;

            SilentlyFail     = false;
            CaughtExceptions = null;

            Conventions = migrationRunnerConventions ?? GetMigrationRunnerConventions(runnerContext);

            var convSet = conventionSet ?? new DefaultConventionSet(runnerContext);

            _migrationScopeHandler = new MigrationScopeHandler(Processor);
            _migrationValidator    = new MigrationValidator(_announcer, convSet);
            MigrationLoader        = new DefaultMigrationInformationLoader(Conventions, _migrationAssemblies,
                                                                           runnerContext.Namespace,
                                                                           runnerContext.NestedNamespaces, runnerContext.Tags);
            ProfileLoader     = new ProfileLoader(runnerContext, this, Conventions);
            MaintenanceLoader = new MaintenanceLoader(_migrationAssemblies, runnerContext.Tags, Conventions);

            if (runnerContext.NoConnection)
            {
                VersionLoader = new ConnectionlessVersionLoader(
                    this, _migrationAssemblies, convSet, Conventions,
                    runnerContext.StartVersion, runnerContext.Version, versionTableMetaData);
            }
            else
            {
                VersionLoader = new VersionLoader(this, _migrationAssemblies, convSet, Conventions, versionTableMetaData);
            }
        }