示例#1
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);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#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);
        }
示例#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);
        }
示例#6
0
        public void CreateContext_get_service()
        {
            var assembly   = MockAssembly.Create(typeof(Startup));
            var operations = new DbContextOperations(
                new TestOperationReporter(),
                assembly,
                assembly);

            operations.CreateContext(typeof(TestContext).FullName);
        }