|
1 | | -// Copyright (C) 2007-2022 Xtensive LLC. |
| 1 | +// Copyright (C) 2007-2024 Xtensive LLC. |
2 | 2 | // This code is distributed under MIT license terms. |
3 | 3 | // See the License.txt file in the project root for more information. |
4 | 4 | // Created by: Dmitri Maximov |
@@ -73,7 +73,7 @@ public class DomainConfiguration : ConfigurationBase |
73 | 73 | public const bool DefaultShareStorageSchemaOverNodes = false; |
74 | 74 |
|
75 | 75 | /// <summary> |
76 | | - /// Default <see cref="AllowCyclicDatabaseDependencies" /> value: <see langword="false" /> |
| 76 | + /// Default <see cref="AllowCyclicDatabaseDependencies" /> value: <see langword="false" />. |
77 | 77 | /// </summary> |
78 | 78 | public const bool DefaultAllowCyclicDatabaseDependencies = false; |
79 | 79 |
|
@@ -881,8 +881,25 @@ private static DomainConfiguration LoadConfigurationFromSection(ConfigurationSec |
881 | 881 | /// <exception cref="InvalidOperationException">The "domains" section is not found or domain with requested name is not found.</exception> |
882 | 882 | public static DomainConfiguration Load(IConfigurationSection configurationSection, string name) |
883 | 883 | { |
884 | | - throw new NotImplementedException(); |
| 884 | + var allDomainsSection = configurationSection.GetSection("Domains"); |
| 885 | + if (allDomainsSection != null && allDomainsSection.GetChildren().Any()) { |
| 886 | + var domainSection = allDomainsSection.GetSection(name); |
| 887 | + if (domainSection.GetChildren().Any()) { |
| 888 | + var parseResult = new FromJsonToDomainConfigurationParser().Parse(domainSection); |
| 889 | + if (parseResult != null) |
| 890 | + return parseResult; |
| 891 | + } |
| 892 | + else if ((domainSection = allDomainsSection.GetSection($"Domain:{name}")).GetChildren().Any()) { |
| 893 | + var parseResult = new XmlDomainConfigParser().Parse(domainSection); |
| 894 | + if (parseResult != null) |
| 895 | + return parseResult; |
| 896 | + } |
| 897 | + } |
| 898 | + |
| 899 | + throw new InvalidOperationException(string.Format( |
| 900 | + Strings.ExConfigurationForDomainIsNotFoundInApplicationConfigurationFile, name, sectionName)); |
885 | 901 | } |
| 902 | + |
886 | 903 | #endregion |
887 | 904 |
|
888 | 905 | // Constructors |
|
0 commit comments