Ejemplo n.º 1
0
        public MigrationsOperations(
            [NotNull] IOperationReporter reporter,
            [NotNull] Assembly assembly,
            [NotNull] Assembly startupAssembly,
            [CanBeNull] string environment,
            [NotNull] string projectDir,
            [NotNull] string contentRootPath,
            [NotNull] string rootNamespace)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotEmpty(contentRootPath, nameof(contentRootPath));
            Check.NotNull(rootNamespace, nameof(rootNamespace));

            _reporter          = reporter;
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _contextOperations = new DbContextOperations(
                reporter,
                assembly,
                startupAssembly,
                environment,
                contentRootPath);

            var startup = new StartupInvoker(reporter, startupAssembly, environment, contentRootPath);

            _servicesBuilder = new DesignTimeServicesBuilder(startup);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public MigrationsOperations(
            [NotNull] IOperationReporter reporter,
            [NotNull] Assembly assembly,
            [NotNull] Assembly startupAssembly,
            [NotNull] string projectDir,
            [NotNull] string rootNamespace,
            [CanBeNull] string language,
            [NotNull] string[] args)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotNull(rootNamespace, nameof(rootNamespace));
            Check.NotNull(args, nameof(args));

            _reporter          = reporter;
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _language          = language;
            _contextOperations = new DbContextOperations(
                reporter,
                assembly,
                startupAssembly,
                args);

            _servicesBuilder = new DesignTimeServicesBuilder(startupAssembly, reporter, args);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public MigrationsOperations(
            [NotNull] IOperationReporter reporter,
            [NotNull] Assembly assembly,
            [NotNull] Assembly startupAssembly,
            [NotNull] string projectDir,
            [NotNull] string rootNamespace,
            [CanBeNull] string language,
            [NotNull] string[] args)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotNull(rootNamespace, nameof(rootNamespace));
            // Note: cannot assert that args is not null - as old versions of
            // tools can still pass null.

            _reporter          = reporter;
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _language          = language;
            _args              = args ?? Array.Empty <string>();
            _contextOperations = new DbContextOperations(
                reporter,
                assembly,
                startupAssembly,
                _args);

            _servicesBuilder = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public MigrationsOperations(
            IOperationReporter reporter,
            Assembly assembly,
            Assembly startupAssembly,
            string projectDir,
            string?rootNamespace,
            string?language,
            bool nullable,
            string[]?args)
        {
            _reporter          = reporter;
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _language          = language;
            _nullable          = nullable;
            _args              = args ?? Array.Empty <string>();
            _contextOperations = new DbContextOperations(
                reporter,
                assembly,
                startupAssembly,
                projectDir,
                rootNamespace,
                language,
                nullable,
                _args);

            _servicesBuilder = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public MigrationsOperations(
            IOperationReporter reporter,
            Assembly assembly,
            Assembly startupAssembly,
            string projectDir,
            string?rootNamespace,
            string?language,
            string[]?args)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));

            _reporter          = reporter;
            _assembly          = assembly;
            _projectDir        = projectDir;
            _rootNamespace     = rootNamespace;
            _language          = language;
            _args              = args ?? Array.Empty <string>();
            _contextOperations = new DbContextOperations(
                reporter,
                assembly,
                startupAssembly,
                _args);

            _servicesBuilder = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        protected DbContextOperations(
            IOperationReporter reporter,
            Assembly assembly,
            Assembly startupAssembly,
            string projectDir,
            string?rootNamespace,
            string?language,
            bool nullable,
            string[]?args,
            AppServiceProviderFactory appServicesFactory)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(assembly, nameof(assembly));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));

            _reporter           = reporter;
            _assembly           = assembly;
            _startupAssembly    = startupAssembly;
            _projectDir         = projectDir;
            _rootNamespace      = rootNamespace;
            _language           = language;
            _nullable           = nullable;
            _args               = args ?? Array.Empty <string>();
            _appServicesFactory = appServicesFactory;
            _servicesBuilder    = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args);
        }
        public DatabaseOperations(
            [NotNull] IOperationReporter reporter,
            [NotNull] Assembly startupAssembly,
            [NotNull] string projectDir,
            [NotNull] string rootNamespace)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotNull(rootNamespace, nameof(rootNamespace));

            _reporter      = reporter;
            _projectDir    = projectDir;
            _rootNamespace = rootNamespace;

            _servicesBuilder = new DesignTimeServicesBuilder(startupAssembly, reporter);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public DatabaseOperations(
            IOperationReporter reporter,
            Assembly assembly,
            Assembly startupAssembly,
            string projectDir,
            string?rootNamespace,
            string?language,
            bool nullable,
            string[]?args)
        {
            Check.NotNull(reporter, nameof(reporter));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));

            _reporter      = reporter;
            _projectDir    = projectDir;
            _rootNamespace = rootNamespace;
            _language      = language;
            _nullable      = nullable;
            _args          = args ?? Array.Empty <string>();

            _servicesBuilder = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args);
        }
Ejemplo n.º 9
0
        public DatabaseOperations(
            [NotNull] ILoggerProvider loggerProvider,
            [NotNull] AssemblyLoader startupAssemblyLoader,
            [NotNull] Assembly startupAssembly,
            [CanBeNull] string environment,
            [NotNull] string projectDir,
            [NotNull] string contentRootPath,
            [NotNull] string rootNamespace)
        {
            Check.NotNull(startupAssemblyLoader, nameof(startupAssemblyLoader));
            Check.NotNull(loggerProvider, nameof(loggerProvider));
            Check.NotNull(startupAssembly, nameof(startupAssembly));
            Check.NotNull(projectDir, nameof(projectDir));
            Check.NotEmpty(contentRootPath, nameof(contentRootPath));
            Check.NotNull(rootNamespace, nameof(rootNamespace));

            _loggerProvider = loggerProvider;
            _projectDir = projectDir;
            _rootNamespace = rootNamespace;

            var logger = new LazyRef<ILogger>(() => loggerProvider.CreateCommandsLogger());
            var startup = new StartupInvoker(logger, startupAssembly, environment, contentRootPath);
            _servicesBuilder = new DesignTimeServicesBuilder(startupAssemblyLoader, startup);
        }