// Constructors

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

            services = context.Services;
            executor = session.Services.Demand <ISqlExecutor>();
        }
Example #2
0
        public FullTextCatalogNameBuilder()
        {
            var context = UpgradeContext.Demand();

            DomainConfiguration = context.Configuration;
            NodeConfiguration   = context.NodeConfiguration;
            defaultDatabase     = context.DefaultSchemaInfo.Database;
            defaultSchema       = context.DefaultSchemaInfo.Schema;
        }
Example #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);
                }
        }
Example #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;
            }
        }
Example #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);
                }
        }
Example #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());
                }
        }
Example #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;
        }
Example #9
0
        // Constructors

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

            upgradeMode = context.UpgradeMode;
        }
Example #10
0
        // Constructors

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