/// <summary>
        /// Converts the element to a native configuration object it corresponds to -
        /// i.e. to a <see cref="VersioningConvention"/> object.
        /// </summary>
        /// <returns>The result of conversion.</returns>
        public VersioningConvention ToNative()
        {
            var result = new VersioningConvention {
                EntityVersioningPolicy          = (EntityVersioningPolicy)Enum.Parse(typeof(EntityVersioningPolicy), EntityVersioningPolicy, true),
                DenyEntitySetOwnerVersionChange = DenyEntitySetOwnerVersionChange
            };

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Converts the element to a native configuration object it corresponds to -
        /// i.e. to a <see cref="DomainConfiguration"/> object.
        /// </summary>
        /// <returns>The result of conversion.</returns>
        public DomainConfiguration ToNative()
        {
            var config = new DomainConfiguration {
                Name                            = Name,
                ConnectionInfo                  = ConnectionInfoParser.GetConnectionInfo(CurrentConfiguration, ConnectionUrl, Provider, ConnectionString),
                NamingConvention                = NamingConvention.ToNative(),
                KeyCacheSize                    = KeyCacheSize,
                KeyGeneratorCacheSize           = KeyGeneratorCacheSize,
                QueryCacheSize                  = QueryCacheSize,
                RecordSetMappingCacheSize       = RecordSetMappingCacheSize,
                DefaultSchema                   = DefaultSchema,
                DefaultDatabase                 = DefaultDatabase,
                UpgradeMode                     = ParseEnum <DomainUpgradeMode>(UpgradeMode),
                ForeignKeyMode                  = ParseEnum <ForeignKeyMode>(ForeignKeyMode),
                SchemaSyncExceptionFormat       = ParseEnum <SchemaSyncExceptionFormat>(SchemaSyncExceptionFormat),
                Options                         = ParseEnum <DomainOptions>(Options),
                ServiceContainerType            = ServiceContainerType.IsNullOrEmpty() ? null : Type.GetType(ServiceContainerType),
                IncludeSqlInExceptions          = IncludeSqlInExceptions,
                BuildInParallel                 = BuildInParallel,
                AllowCyclicDatabaseDependencies = AllowCyclicDatabaseDependencies,
                ForcedServerVersion             = ForcedServerVersion,
                Collation                       = Collation,
                ConnectionInitializationSql     = ConnectionInitializationSql,
                MultidatabaseKeys               = MultidatabaseKeys,
                ShareStorageSchemaOverNodes     = ShareStorageSchemaOverNodes,
                EnsureConnectionIsAlive         = EnsureConnectionIsAlive,
                FullTextChangeTrackingMode      = ParseEnum <FullTextChangeTrackingMode>(FullTextChangeTrackingMode),
                VersioningConvention            = VersioningConvention.ToNative()
            };

            foreach (var element in Types)
            {
                config.Types.Register(element.ToNative());
            }
            foreach (var element in Sessions)
            {
                config.Sessions.Add(element.ToNative());
            }
            foreach (var element in MappingRules)
            {
                config.MappingRules.Add(element.ToNative());
            }
            foreach (var element in Databases)
            {
                config.Databases.Add(element.ToNative());
            }
            foreach (var element in KeyGenerators)
            {
                config.KeyGenerators.Add(element.ToNative());
            }
            foreach (var element in IgnoreRules)
            {
                config.IgnoreRules.Add(element.ToNative());
            }

            return(config);
        }