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); } }
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); } }
/// <summary> /// Initializes a new instance of the <see cref="MigrationRunner"/> class. /// </summary> /// <param name="options">The migration runner options</param> /// <param name="processorOptions">The migration processor options</param> /// <param name="profileLoader">The profile loader</param> /// <param name="processorAccessor">The migration processor accessor</param> /// <param name="maintenanceLoader">The maintenance loader</param> /// <param name="migrationLoader">The migration loader</param> /// <param name="logger">The logger</param> /// <param name="stopWatch">The stopwatch</param> /// <param name="migrationRunnerConventionsAccessor">The accessor for migration runner conventions</param> /// <param name="assemblySource">The assemblies to scan for migrations, etc...</param> /// <param name="migrationValidator">The validator for migrations</param> /// <param name="serviceProvider">The service provider</param> public MigrationRunner( [NotNull] IOptions <RunnerOptions> options, [NotNull] IOptionsSnapshot <ProcessorOptions> processorOptions, [NotNull] IProfileLoader profileLoader, [NotNull] IProcessorAccessor processorAccessor, [NotNull] IMaintenanceLoader maintenanceLoader, [NotNull] IMigrationInformationLoader migrationLoader, [NotNull] ILogger <MigrationRunner> logger, [NotNull] IStopWatch stopWatch, [NotNull] IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor, [NotNull] IAssemblySource assemblySource, [NotNull] MigrationValidator migrationValidator, [NotNull] IServiceProvider serviceProvider) : this( options, processorOptions, profileLoader, processorAccessor, maintenanceLoader, migrationLoader, logger, stopWatch, migrationRunnerConventionsAccessor, assemblySource, migrationValidator, serviceProvider, migrationScopeHandler : null) { }
public MigrationRunner( [NotNull] IAssemblyCollection assemblies, [NotNull] IRunnerContext runnerContext, [NotNull] IMigrationProcessor processor, [CanBeNull] IVersionTableMetaData versionTableMetaData, [CanBeNull] IMigrationRunnerConventions migrationRunnerConventions, [CanBeNull] IConventionSet conventionSet, [CanBeNull] IMigrationScopeManager migrationScopeHandler = null) { _migrationAssemblies = assemblies; _logger = new AnnouncerFluentMigratorLogger(runnerContext.Announcer); _stopWatch = runnerContext.StopWatch; _processorOptions = new ProcessorOptions(runnerContext); Processor = processor; RunnerContext = runnerContext; var migrationRunnerConventionsAccessor = new AssemblySourceMigrationRunnerConventionsAccessor( serviceProvider: null, new AssemblySource(() => assemblies)); Conventions = migrationRunnerConventions ?? migrationRunnerConventionsAccessor.MigrationRunnerConventions; var convSet = conventionSet ?? new DefaultConventionSet(runnerContext); _migrationScopeManager = migrationScopeHandler ?? new MigrationScopeHandler(Processor); _migrationValidator = new MigrationValidator(_logger, 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 Lazy <IVersionLoader>( () => new ConnectionlessVersionLoader( this, _migrationAssemblies, convSet, Conventions, runnerContext, versionTableMetaData)); } else { _versionLoader = new Lazy <IVersionLoader>( () => new VersionLoader(this, _migrationAssemblies, convSet, Conventions, runnerContext, versionTableMetaData)); } }
public MigrationRunner(Assembly assembly, IRunnerContext runnerContext, IMigrationProcessor processor) { _migrationAssembly = assembly; _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); VersionLoader = new VersionLoader(this, _migrationAssembly, Conventions); MigrationLoader = new DefaultMigrationInformationLoader(Conventions, _migrationAssembly, runnerContext.Namespace, runnerContext.NestedNamespaces, runnerContext.Tags); ProfileLoader = new ProfileLoader(runnerContext, this, Conventions); }
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); } }
/// <summary> /// Initializes a new instance of the <see cref="MigrationRunner"/> class. /// </summary> /// <param name="options">The migration runner options</param> /// <param name="processorOptions">The migration processor options</param> /// <param name="profileLoader">The profile loader</param> /// <param name="processorAccessor">The migration processor accessor</param> /// <param name="maintenanceLoader">The maintenance loader</param> /// <param name="migrationLoader">The migration loader</param> /// <param name="logger">The logger</param> /// <param name="stopWatch">The stopwatch</param> /// <param name="migrationRunnerConventionsAccessor">The accessor for migration runner conventions</param> /// <param name="assemblySource">The assemblies to scan for migrations, etc...</param> /// <param name="migrationValidator">The validator for migrations</param> /// <param name="serviceProvider">The service provider</param> /// <param name="migrationScopeHandler">THe migration scope handler</param> public MigrationRunner( [NotNull] IOptions <RunnerOptions> options, [NotNull] IOptionsSnapshot <ProcessorOptions> processorOptions, [NotNull] IProfileLoader profileLoader, [NotNull] IProcessorAccessor processorAccessor, [NotNull] IMaintenanceLoader maintenanceLoader, [NotNull] IMigrationInformationLoader migrationLoader, [NotNull] ILogger <MigrationRunner> logger, [NotNull] IStopWatch stopWatch, [NotNull] IMigrationRunnerConventionsAccessor migrationRunnerConventionsAccessor, [NotNull] IAssemblySource assemblySource, [NotNull] MigrationValidator migrationValidator, [NotNull] IServiceProvider serviceProvider, [CanBeNull] IMigrationScopeManager migrationScopeHandler) { Processor = processorAccessor.Processor; Conventions = migrationRunnerConventionsAccessor.MigrationRunnerConventions; ProfileLoader = profileLoader; MaintenanceLoader = maintenanceLoader; MigrationLoader = migrationLoader; _serviceProvider = serviceProvider; _options = options.Value; _logger = logger; _stopWatch = stopWatch; _processorOptions = processorOptions.Value; _migrationScopeManager = migrationScopeHandler ?? new MigrationScopeHandler(Processor, processorOptions.Value); _migrationValidator = migrationValidator; _versionLoader = new Lazy <IVersionLoader>(serviceProvider.GetRequiredService <IVersionLoader>); #pragma warning disable 612 #pragma warning disable 618 _migrationAssemblies = new AssemblyCollectionService(assemblySource); #pragma warning restore 618 #pragma warning restore 612 }
public MigrationRunner(Assembly assembly, IRunnerContext runnerContext, IMigrationProcessor processor, IVersionTableMetaData versionTableMetaData = null) { _migrationAssembly = assembly; _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); VersionLoader = new VersionLoader(this, _migrationAssembly, Conventions, versionTableMetaData); MigrationLoader = new DefaultMigrationInformationLoader(Conventions, _migrationAssembly, runnerContext.Namespace, runnerContext.NestedNamespaces, runnerContext.Tags); ProfileLoader = new ProfileLoader(runnerContext, this, Conventions); }
public void Setup() { migration = Mock.Of<IMigration>(); migrationValidator = new MigrationValidator(Mock.Of<IAnnouncer>(), new MigrationConventions()); }