NamespaceSystemLibrary.Common.Net
Class for creating configurations (xml or json) files next to your code files
Configurations can be placed in either: ~/.json, ~/.xml, ~/Configs/.[json|xml], or ~/Configurations/.[json|xml]
Or appended to your existing 'appSettings.json' file
Transformations are ran based on the 'ASPNETCORE_ENVIRONMENT' variable passed to your application
Some recommended pointers:
- launchSettings.json when using IIS Express
- web.config if you use IIS
- mstest.runsettings if you run transformations in unit tests
- commandline with --configuration if running as 'exe'
NOTE: Read the example of 'EnvironmentConfig.Name' property, it gives details on where/how to set environment per application type
NOTE: Transformations are only ran on the first time '.Current' is invoked
NOTE: Environment variables like 'UserName', is added only to 'appSettings' and not your custom configurations like: ~/Configs/testConfig.json, which mean 'UserName' always exists in 'AppSettings' if you create the string variable and returns the user name on your computer
WARNING: The generic T cannot be a nested class
Config<T>
public abstract class Config<T> where T : class
Type Parameters
Name | Description |
---|---|
T | T is the class inheriting Config<>, also referenced as 'self'. Note that T cannot be a nested class |
Properties
Property Value
Type | Description |
---|---|
T |
Extension Methods
}