-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from DataObjects-NET/7.1-ioptions-config-loading
Ability to load configurations from IConfigurationSection/IConfigurationRoot
- Loading branch information
Showing
89 changed files
with
12,469 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
[main] Addressed issue when cycles in Entity dependency graph were not detected | ||
[main] Addressed issue when cycles in Entity dependency graph were not detected | ||
[main] Intoduced DomainConfuguration.ExtensionConfigurations as unified configuration storage for extensions' configurations | ||
[main] DomainConfiguration.Load() method now has overloads which gets abstractions from Microsoft.Extensions.Configuration API | ||
[localization] LocalizationConfiguration.Load() method now has overloads which gets abstractions from Microsoft.Extensions.Configuration API | ||
[localization] ConfigureLocalizationExtension() extensions for DomainConfiguration are added, check ReadMe/documentation for examples of usage | ||
[reprocessing] ReprocessingConfiguration.Load() method now has overloads which gets abstractions from Microsoft.Extensions.Configuration API | ||
[reprocessing] ConfigureReprocessingExtension() extensions for DomainConfiguration are added, check ReadMe/documentation for examples of usage | ||
[security] SecurityConfiguration.Load() method now has overloads which gets abstractions from Microsoft.Extensions.Configuration API | ||
[security] ConfigureSecurityExtension() extensions for DomainConfiguration are added, check ReadMe/documentation for examples of usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Configuration; | ||
using NUnit.Framework; | ||
|
||
namespace TestCommon | ||
{ | ||
public abstract class MicrosoftConfigurationTestBase | ||
{ | ||
protected enum ConfigTypes | ||
{ | ||
Json, | ||
Xml, | ||
} | ||
|
||
protected IConfigurationRoot configurationRoot; | ||
|
||
protected abstract ConfigTypes ConfigFormat { get; } | ||
|
||
protected abstract void AddConfigurationFile(IConfigurationBuilder configurationBuilder); | ||
|
||
[OneTimeSetUp] | ||
public virtual void BeforeAllTestsSetUp() | ||
{ | ||
var configurationBuilder = new ConfigurationBuilder(); | ||
configurationBuilder.SetBasePath(Directory.GetCurrentDirectory()); | ||
AddConfigurationFile(configurationBuilder); | ||
configurationRoot = (ConfigurationRoot) configurationBuilder.Build(); | ||
} | ||
|
||
protected void IgnoreIfXml() | ||
{ | ||
if (ConfigFormat == ConfigTypes.Xml) | ||
throw new IgnoreException("Not valid for Xml format"); | ||
} | ||
protected void IgnoreIfJson() | ||
{ | ||
if (ConfigFormat == ConfigTypes.Json) | ||
throw new IgnoreException("Not valid for JSON format"); | ||
} | ||
|
||
protected IConfigurationSection GetAndCheckConfigurationSection(string sectionName) | ||
{ | ||
var section = configurationRoot.GetSection(sectionName); | ||
Assert.That(section, Is.Not.Null); | ||
return section; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
Extensions/Xtensive.Orm.Localization.Tests/LocalizationSettings.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<!-- No elements, all names should be default--> | ||
<Xtensive.Orm.Localization.Xml.Empty> | ||
</Xtensive.Orm.Localization.Xml.Empty> | ||
|
||
<!--Names are empty, all names should be default--> | ||
<Xtensive.Orm.Localization.Xml.NameEmpty> | ||
<DefaultCulture></DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameEmpty> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameDefined> | ||
<DefaultCulture>es-ES</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameDefined> | ||
|
||
<Xtensive.Orm.Localization.Xml.FaultyValue> | ||
<DefaultCulture>ololo</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.FaultyValue> | ||
|
||
<!-- Different namings schemes of elements --> | ||
<!-- LC - lower case --> | ||
<!-- UC - upper case --> | ||
<!-- CC - camel case --> | ||
<!-- PC - pascal case--> | ||
<Xtensive.Orm.Localization.Xml.Naming.LC> | ||
<defaultculture>es-ES</defaultculture> | ||
</Xtensive.Orm.Localization.Xml.Naming.LC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Naming.UC> | ||
<DEFAULTCULTURE>es-ES</DEFAULTCULTURE> | ||
</Xtensive.Orm.Localization.Xml.Naming.UC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Naming.CC> | ||
<defaultCulture>es-ES</defaultCulture> | ||
</Xtensive.Orm.Localization.Xml.Naming.CC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Naming.PC> | ||
<DefaultCulture>es-ES</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.Naming.PC> | ||
|
||
<!-- Cases of mistyping of element names --> | ||
<!-- LC - lower case --> | ||
<!-- UC - upper case --> | ||
<!-- CC - camel case --> | ||
<!-- PC - pascal case--> | ||
<Xtensive.Orm.Localization.Xml.Mistype.LC> | ||
<defailtculture>es-ES</defailtculture> | ||
</Xtensive.Orm.Localization.Xml.Mistype.LC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Mistype.UC> | ||
<DEFAILTCULTURE>es-ES</DEFAILTCULTURE> | ||
</Xtensive.Orm.Localization.Xml.Mistype.UC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Mistype.CC> | ||
<defailtCulture>es-ES</defailtCulture> | ||
</Xtensive.Orm.Localization.Xml.Mistype.CC> | ||
|
||
<Xtensive.Orm.Localization.Xml.Mistype.PC> | ||
<DefailtCulture>es-ES</DefailtCulture> | ||
</Xtensive.Orm.Localization.Xml.Mistype.PC> | ||
|
||
<!-- Cases of configuration when service name is represented by Name child node --> | ||
<Xtensive.Orm.Localization.Xml.NameNode.NameEmpty> | ||
<DefaultCulture> | ||
<Name></Name> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.NameEmpty> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.Espaniol> | ||
<DefaultCulture> | ||
<Name>es-ES</Name> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.Espaniol> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.FaultyValue> | ||
<DefaultCulture> | ||
<Name>ololo</Name> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.FaultyValue> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.Naming.LC> | ||
<DefaultCulture> | ||
<name>es-ES</name> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.Naming.LC> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.Naming.UC> | ||
<DefaultCulture> | ||
<NAME>es-ES</NAME> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.Naming.UC> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.Naming.CC> | ||
<DefaultCulture> | ||
<naMe>es-ES</naMe> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.Naming.CC> | ||
|
||
<Xtensive.Orm.Localization.Xml.NameNode.Naming.PC> | ||
<DefaultCulture> | ||
<NaMe>es-ES</NaMe> | ||
</DefaultCulture> | ||
</Xtensive.Orm.Localization.Xml.NameNode.Naming.PC> | ||
|
||
|
||
<!-- combinations of Xml-specifit cases, mostly old-fashion attributes --> | ||
<Xtensive.Orm.Localization.NameAttribute.NameEmpty> | ||
<defaultCulture name="" /> | ||
</Xtensive.Orm.Localization.NameAttribute.NameEmpty> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.None> | ||
<defaultCulture /> | ||
</Xtensive.Orm.Localization.NameAttribute.None> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.Defined> | ||
<defaultCulture name="es-ES" /> | ||
</Xtensive.Orm.Localization.NameAttribute.Defined> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.FaultyValue> | ||
<defaultCulture name="ololo" /> | ||
</Xtensive.Orm.Localization.NameAttribute.FaultyValue> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.LC> | ||
<defaultculture name="es-ES" /> | ||
</Xtensive.Orm.Localization.NameAttribute.LC> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.UC> | ||
<DEFAULTCULTURE name="es-ES" /> | ||
</Xtensive.Orm.Localization.NameAttribute.UC> | ||
|
||
<Xtensive.Orm.Localization.NameAttribute.PC> | ||
<DefaultCulture name="es-ES" /> | ||
</Xtensive.Orm.Localization.NameAttribute.PC> | ||
|
||
</configuration> |
Oops, something went wrong.