public TaskExecutor( [NotNull] ILogger <TaskExecutor> logger, [NotNull] IAssemblySource assemblySource, [NotNull] IOptions <RunnerOptions> runnerOptions, [NotNull] IServiceProvider serviceProvider) { _logger = logger; _assemblySource = assemblySource; _runnerOptions = runnerOptions.Value; #pragma warning disable 612 ConnectionStringProvider = serviceProvider.GetService <IConnectionStringProvider>(); #pragma warning restore 612 _lazyServiceProvider = new Lazy <IServiceProvider>(() => serviceProvider); }
public TaskExecutor([NotNull] IRunnerContext runnerContext) { var runnerCtxt = runnerContext ?? throw new ArgumentNullException(nameof(runnerContext)); _logger = new AnnouncerFluentMigratorLogger(runnerCtxt.Announcer); _runnerOptions = new RunnerOptions(runnerCtxt); var asmLoaderFactory = new AssemblyLoaderFactory(); _assemblySource = new AssemblySource(() => new AssemblyCollection(asmLoaderFactory.GetTargetAssemblies(runnerCtxt.Targets))); ConnectionStringProvider = new DefaultConnectionStringProvider(); _lazyServiceProvider = new Lazy <IServiceProvider>( () => runnerContext .CreateServices( ConnectionStringProvider, asmLoaderFactory) .BuildServiceProvider(validateScopes: true)); }