// Constructors

        public SchemaExtractor(UpgradeContext context, Session session)
        {
            this.context = context;

            services = context.Services;
            executor = session.Services.Demand <ISqlExecutor>();
        }
Пример #2
0
        public FullTextCatalogNameBuilder()
        {
            var context = UpgradeContext.Demand();

            DomainConfiguration = context.Configuration;
            NodeConfiguration   = context.NodeConfiguration;
            defaultDatabase     = context.DefaultSchemaInfo.Database;
            defaultSchema       = context.DefaultSchemaInfo.Schema;
        }
Пример #3
0
        public static StorageNode BuildNode(Domain parentDomain, NodeConfiguration nodeConfiguration)
        {
            ArgumentValidator.EnsureArgumentNotNull(parentDomain, "parentDomain");
            ArgumentValidator.EnsureArgumentNotNull(nodeConfiguration, "nodeConfiguration");

            nodeConfiguration.Validate(parentDomain.Configuration);
            if (!nodeConfiguration.IsLocked)
            {
                nodeConfiguration.Lock();
            }

            var context = new UpgradeContext(parentDomain, nodeConfiguration);

            using (context.Activate())
                using (context.Services) {
                    new UpgradingDomainBuilder(context).Run();
                    return(context.StorageNode);
                }
        }
Пример #4
0
        // Constructors

        public SchemaUpgrader(UpgradeContext context, Session session)
        {
            this.context = context;
            this.session = session;

            services   = context.Services;
            connection = context.Services.Connection;
            executor   = session.Services.Demand <ISqlExecutor>();

            driver = services.StorageDriver;
            if (driver.ProviderInfo.Supports(ProviderFeatures.TransactionalDdl))
            {
                statementProcessor = ExecuteTransactionally;
            }
            else
            {
                statementProcessor = ExecuteNonTransactionally;
            }
        }
Пример #5
0
        public static async Task <StorageNode> BuildNodeAsync(
            Domain parentDomain, NodeConfiguration nodeConfiguration, CancellationToken token)
        {
            ArgumentValidator.EnsureArgumentNotNull(parentDomain, nameof(parentDomain));
            ArgumentValidator.EnsureArgumentNotNull(nodeConfiguration, nameof(nodeConfiguration));

            nodeConfiguration.Validate(parentDomain.Configuration);
            if (!nodeConfiguration.IsLocked)
            {
                nodeConfiguration.Lock();
            }

            var context = new UpgradeContext(parentDomain, nodeConfiguration);

            using (context.Activate())
                using (context.Services) {
                    await new UpgradingDomainBuilder(context).RunAsync(token).ConfigureAwait(false);
                    return(context.StorageNode);
                }
        }
Пример #6
0
        public static Domain Build(DomainConfiguration configuration)
        {
            ArgumentValidator.EnsureArgumentNotNull(configuration, "configuration");

            if (configuration.ConnectionInfo == null)
            {
                throw new ArgumentException(Strings.ExConnectionInfoIsMissing, "configuration");
            }

            if (!configuration.IsLocked)
            {
                configuration.Lock();
            }

            LogManager.Default.AutoInitialize();

            var context = new UpgradeContext(configuration);

            using (context.Activate())
                using (context.Services) {
                    return(new UpgradingDomainBuilder(context).Run());
                }
        }
Пример #7
0
        public static async Task <Domain> BuildAsync(DomainConfiguration configuration, CancellationToken token)
        {
            ArgumentValidator.EnsureArgumentNotNull(configuration, nameof(configuration));

            if (configuration.ConnectionInfo == null)
            {
                throw new ArgumentException(Strings.ExConnectionInfoIsMissing, nameof(configuration));
            }

            if (!configuration.IsLocked)
            {
                configuration.Lock();
            }

            LogManager.Default.AutoInitialize();

            var context = new UpgradeContext(configuration);

            using (context.Activate())
                using (context.Services) {
                    return(await new UpgradingDomainBuilder(context).RunAsync(token).ConfigureAwait(false));
                }
        }
        // Constructors

        public TypeIdProvider(UpgradeContext context)
        {
            ArgumentValidator.EnsureArgumentNotNull(context, "context");
            this.context = context;
        }
Пример #9
0
        // Constructors

        private UpgradingDomainBuilder(UpgradeContext context)
        {
            this.context = context;

            upgradeMode = context.UpgradeMode;
        }
Пример #10
0
        // Constructors

        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        public UpgradeHandler()
        {
            UpgradeContext = UpgradeContext.Demand();
        }