Esempio n. 1
0
        public MigrationsOperations(
            [NotNull] ILoggerProvider loggerProvider,
            [NotNull] Assembly assembly,
            [NotNull] Assembly startupAssembly,
            [CanBeNull] string environment,
            [NotNull] string projectDir,
            [NotNull] string rootNamespace)
        {
            Check.NotNull(loggerProvider, nameof(loggerProvider));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotNull(rootNamespace, nameof(rootNamespace));

            var loggerFactory = new LoggerFactory();

            loggerFactory.AddProvider(loggerProvider);

            _loggerProvider    = loggerProvider;
            _logger            = new LazyRef <ILogger>(() => loggerFactory.CreateCommandsLogger());
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _contextOperations = new DbContextOperations(
                loggerProvider,
                assembly,
                startupAssembly,
                projectDir,
                environment);

            var startup = new StartupInvoker(startupAssembly, environment);

            _servicesBuilder = new DesignTimeServicesBuilder(startup);
        }