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
collectionConnectionStringSettingsCollectionThe collection.
unqualifiedKeystringThe unqualified key.
environmentNamestringName 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
collectionConnectionStringSettingsCollectionThe collection.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
throwConfigurationErrorsExceptionboolif set to
truethrow 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
collectionConnectionStringSettingsCollectionThe collection.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
delimiterstringThe 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
collectionConnectionStringSettingsCollectionThe collection.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
delimiterstringThe delimiter.
throwConfigurationErrorsExceptionboolif set to
truethrow configuration errors exception.
Returns
GetConnectionStringSettings(ConnectionStringSettingsCollection?, string?)
Gets the connection string settings.
public static ConnectionStringSettings? GetConnectionStringSettings(this ConnectionStringSettingsCollection? collection, string? connectionName)
Parameters
collectionConnectionStringSettingsCollectionThe collection.
connectionNamestringName 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
collectionConnectionStringSettingsCollectionThe collection.
connectionNamestringName of the connection.
throwConfigurationErrorsExceptionboolif set to
truethrow configuration errors exception.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings)
Parameters
settingsKeyValueConfigurationCollectionThe settings.
Returns
GetEnvironmentName(KeyValueConfigurationCollection?, string?)
Gets the name of the conventional deployment environment.
public static string? GetEnvironmentName(this KeyValueConfigurationCollection? settings, string? environmentKey)
Parameters
settingsKeyValueConfigurationCollectionThe settings.
environmentKeystringThe 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
settingsKeyValueConfigurationCollectionThe settings.
environmentKeystringThe environment key.
defaultEnvironmentNamestringDefault 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
settingsKeyValueConfigurationCollectionThe settings.
environmentKeystringThe environment key.
defaultEnvironmentNamestringDefault name of the environment.
throwConfigurationErrorsExceptionboolif set to
truethrow 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
settingsKeyValueConfigurationCollectionThe settings.
unqualifiedKeystringThe unqualified key.
environmentNamestringName 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
settingsKeyValueConfigurationCollectionThe settings.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
throwConfigurationErrorsExceptionboolif 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
settingsKeyValueConfigurationCollectionThe settings.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
delimiterstringThe 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
settingsKeyValueConfigurationCollectionThe settings.
unqualifiedKeystringThe unqualified key.
environmentNamestringName of the environment.
delimiterstringThe delimiter.
throwConfigurationErrorsExceptionboolif set to
truethrow configuration errors exception.
Returns
GetSetting(KeyValueConfigurationCollection?, string?)
Gets the setting from the current KeyValueConfigurationCollection.
public static string? GetSetting(this KeyValueConfigurationCollection? settings, string? key)
Parameters
settingsKeyValueConfigurationCollectionThe settings.
keystringThe 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
settingsKeyValueConfigurationCollectionThe settings.
keystringThe key.
throwConfigurationErrorsExceptionboolif set to
truethrow 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
settingsKeyValueConfigurationCollectionThe settings.
keystringThe key.
throwConfigurationErrorsExceptionboolif set to
truethrow configuration errors exception.settingModifierFunc<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
externalConfigurationDocXDocumentThe external configuration document.
Returns
ToConnectionStringSettingsCollection(XDocument?)
Converts the external configuration file to the application settings ConnectionStringSettingsCollection.
public static ConnectionStringSettingsCollection? ToConnectionStringSettingsCollection(this XDocument? externalConfigurationDoc)
Parameters
externalConfigurationDocXDocumentThe 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
settingsKeyValueConfigurationCollectionThe settings.
externalConfigurationDocXDocumentThe 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
collectionConnectionStringSettingsCollectionThe collection.
externalConfigurationDocXDocumentThe external configuration document.