Example #1
0
        private async Task BuildDomainAsync(string version, DomainUpgradeMode upgradeMode, int?keyCacheSize, params Type[] types)
        {
            if (domain != null)
            {
                domain.Dispose();
            }

            var configuration = DomainConfigurationFactory.Create();

            configuration.UpgradeMode = upgradeMode;
            foreach (var type in types)
            {
                configuration.Types.Register(type);
            }

            if (keyCacheSize.HasValue)
            {
                configuration.KeyGeneratorCacheSize = keyCacheSize.Value;
            }

            configuration.Types.Register(typeof(Upgrader));
            using (Upgrader.Enable(version)) {
                domain = await Domain.BuildAsync(configuration);
            }
        }
Example #2
0
        private Domain BuildDomain(string version, DomainUpgradeMode upgradeMode)
        {
            var configuration = DomainConfigurationFactory.Create();

            configuration.UpgradeMode = upgradeMode;
            configuration.Types.Register(Assembly.GetExecutingAssembly(), "Xtensive.Orm.Tests.Upgrade.PrimaryKeyModel." + version);
            configuration.Types.Register(typeof(Upgrader));
            using (upgradeMode == DomainUpgradeMode.PerformSafely ? Upgrader.Enable() : null) {
                var domain = Domain.Build(configuration);
                return(domain);
            }
        }
Example #3
0
        private void BuildDomain(string version, DomainUpgradeMode upgradeMode)
        {
            if (domain != null)
            {
                domain.DisposeSafely();
            }

            var configuration = DomainConfigurationFactory.Create();

            configuration.UpgradeMode = upgradeMode;
            configuration.Types.Register(Assembly.GetExecutingAssembly(),
                                         "Xtensive.Orm.Tests.Upgrade.Model.Version" + version);
            configuration.Types.Register(typeof(Upgrader));
            using (Upgrader.Enable(version)) {
                domain = Domain.Build(configuration);
            }
        }