Class ConfigurationManagerExtensions
- Namespace
- Songhay.Extensions
- Assembly
- SonghayCore.dll
Extensions of ConfigurationManager
public static class ConfigurationManagerExtensions
- Inheritance
-
ConfigurationManagerExtensions
- Inherited Members
Remarks
Several members in this class depend on DeploymentEnvironment constants.
Methods
GetConnectionNameFromEnvironment(ConnectionStringSettingsCollection?, string?, string?)
Gets the connection name from environment.
public static string? GetConnectionNameFromEnvironment(this ConnectionStringSettingsCollection? collection, string? unqualifiedKey, string? environmentName)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
Returns
GetConnectionNameFromEnvironment(ConnectionStringSettingsCollection?, string?, string?, bool)
Gets the connection name from environment.
public static string? GetConnectionNameFromEnvironment(this ConnectionStringSettingsCollection? collection, string? unqualifiedKey, string? environmentName, bool throwConfigurationErrorsException)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetConnectionNameFromEnvironment(ConnectionStringSettingsCollection?, string?, string?, string?)
Gets the connection name from environment.
public static string? GetConnectionNameFromEnvironment(this ConnectionStringSettingsCollection? collection, string? unqualifiedKey, string? environmentName, string? delimiter)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
delimiter
stringThe delimiter.
Returns
GetConnectionNameFromEnvironment(ConnectionStringSettingsCollection?, string?, string?, string?, bool)
Gets the connection name from environment.
public static string? GetConnectionNameFromEnvironment(this ConnectionStringSettingsCollection? collection, string? unqualifiedKey, string? environmentName, string? delimiter, bool throwConfigurationErrorsException)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
delimiter
stringThe delimiter.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetConnectionStringSettings(ConnectionStringSettingsCollection?, string?)
Gets the connection string settings.
public static ConnectionStringSettings? GetConnectionStringSettings(this ConnectionStringSettingsCollection? collection, string? connectionName)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
connectionName
stringName of the connection.
Returns
GetConnectionStringSettings(ConnectionStringSettingsCollection?, string?, bool)
Gets the connection string settings.
public static ConnectionStringSettings? GetConnectionStringSettings(this ConnectionStringSettingsCollection? collection, string? connectionName, bool throwConfigurationErrorsException)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
connectionName
stringName of the connection.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?, string?)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings, string? environmentKey)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
environmentKey
stringThe environment key.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?, string?, string)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings, string? environmentKey, string defaultEnvironmentName)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
environmentKey
stringThe environment key.
defaultEnvironmentName
stringDefault name of the environment.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?, string?, string, bool)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings, string? environmentKey, string defaultEnvironmentName, bool throwConfigurationErrorsException)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
environmentKey
stringThe environment key.
defaultEnvironmentName
stringDefault name of the environment.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetKeyWithEnvironmentName(KeyValueConfigurationCollection?, string?, string?)
Gets the name of the key with environment.
public static string? GetKeyWithEnvironmentName(this KeyValueConfigurationCollection? settings, string? unqualifiedKey, string? environmentName)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
Returns
GetKeyWithEnvironmentName(KeyValueConfigurationCollection?, string?, string?, bool)
Gets the name of the key with environment.
public static string? GetKeyWithEnvironmentName(this KeyValueConfigurationCollection? settings, string? unqualifiedKey, string? environmentName, bool throwConfigurationErrorsException)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
throwConfigurationErrorsException
boolif set to
true
[throw configuration errors exception].
Returns
GetKeyWithEnvironmentName(KeyValueConfigurationCollection?, string?, string?, string?)
Gets the key with environment name.
public static string? GetKeyWithEnvironmentName(this KeyValueConfigurationCollection? settings, string? unqualifiedKey, string? environmentName, string? delimiter)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
delimiter
stringThe delimiter.
Returns
GetKeyWithEnvironmentName(KeyValueConfigurationCollection?, string?, string?, string?, bool)
Gets the key with environment name.
public static string? GetKeyWithEnvironmentName(this KeyValueConfigurationCollection? settings, string? unqualifiedKey, string? environmentName, string? delimiter, bool throwConfigurationErrorsException)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
unqualifiedKey
stringThe unqualified key.
environmentName
stringName of the environment.
delimiter
stringThe delimiter.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetSetting(KeyValueConfigurationCollection?, string?)
Gets the setting from the current KeyValueConfigurationCollection.
public static string? GetSetting(this KeyValueConfigurationCollection? settings, string? key)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
key
stringThe key.
Returns
GetSetting(KeyValueConfigurationCollection?, string?, bool)
Gets the setting from the current KeyValueConfigurationCollection.
public static string? GetSetting(this KeyValueConfigurationCollection? settings, string? key, bool throwConfigurationErrorsException)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
key
stringThe key.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.
Returns
GetSetting(KeyValueConfigurationCollection?, string?, bool, Func<string?, string>?)
Gets the setting from the current KeyValueConfigurationCollection.
public static string? GetSetting(this KeyValueConfigurationCollection? settings, string? key, bool throwConfigurationErrorsException, Func<string?, string>? settingModifier)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
key
stringThe key.
throwConfigurationErrorsException
boolif set to
true
throw configuration errors exception.settingModifier
Func<string, string>The setting modifier.
Returns
ToAppSettings(XDocument?)
Converts the external configuration file to the application settings KeyValueConfigurationCollection.
public static KeyValueConfigurationCollection? ToAppSettings(this XDocument? externalConfigurationDoc)
Parameters
externalConfigurationDoc
XDocumentThe external configuration document.
Returns
ToConnectionStringSettingsCollection(XDocument?)
Converts the external configuration file to the application settings ConnectionStringSettingsCollection.
public static ConnectionStringSettingsCollection? ToConnectionStringSettingsCollection(this XDocument? externalConfigurationDoc)
Parameters
externalConfigurationDoc
XDocumentThe external configuration document.
Returns
WithAppSettings(KeyValueConfigurationCollection?, XDocument?)
Returns KeyValueConfigurationCollection with the application settings of the specified external configuration XDocument.
public static KeyValueConfigurationCollection? WithAppSettings(this KeyValueConfigurationCollection? settings, XDocument? externalConfigurationDoc)
Parameters
settings
KeyValueConfigurationCollectionThe settings.
externalConfigurationDoc
XDocumentThe external configuration document.
Returns
WithConnectionStringSettingsCollection(ConnectionStringSettingsCollection?, XDocument?)
Returns ConnectionStringSettingsCollection with the application settings of the specified external configuration XDocument.
public static ConnectionStringSettingsCollection? WithConnectionStringSettingsCollection(this ConnectionStringSettingsCollection? collection, XDocument? externalConfigurationDoc)
Parameters
collection
ConnectionStringSettingsCollectionThe collection.
externalConfigurationDoc
XDocumentThe external configuration document.