Class ConfigurationService
Provides a service for retrieving configuration settings.
Implements
Inherited Members
Namespace: DataWeb.Configuration
Assembly: DataWeb.Core.dll
Syntax
public class ConfigurationService : IConfigurationService
Constructors
ConfigurationService(IOptions<ConfigurationAppSettings>, IConfiguration)
Provides a service for retrieving configuration settings.
Declaration
public ConfigurationService(IOptions<ConfigurationAppSettings> options, IConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<ConfigurationAppSettings> | options | The IOptions<TOptions> instance containing the ConfigurationAppSettings. |
| IConfiguration | configuration | The IConfiguration instance. |
Methods
GetAppSetting(string)
Retrieves a specific application setting value from the AppSettings configuration section by its key name.
Declaration
public string GetAppSetting(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The key name of the application setting within the |
Returns
| Type | Description |
|---|---|
| string | The string value of the application setting, or null if the key does not exist. |
GetAppSetting<T>(string)
Retrieves a specific application setting value from the AppSettings configuration section by its key name.
Declaration
public T GetAppSetting<T>(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The key name of the application setting within the |
Returns
| Type | Description |
|---|---|
| T | The value of the application setting converted to |
Type Parameters
| Name | Description |
|---|---|
| T | The type to convert the configuration value to. |
GetAppSettings()
Retrieves the application settings.
Declaration
public ConfigurationAppSettings GetAppSettings()
Returns
| Type | Description |
|---|---|
| ConfigurationAppSettings | A ConfigurationAppSettings instance containing the application settings. |
GetSection(string)
Retrieves a specific configuration section by its full hierarchical key name.
Declaration
public IConfigurationSection GetSection(string fullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fullName | The full hierarchical key of the configuration section (e.g., |
Returns
| Type | Description |
|---|---|
| IConfigurationSection | The IConfigurationSection for the specified key. The section may be empty if the key does not exist. |
GetSetting(string)
Retrieves a specific configuration setting value by its full key name.
Declaration
public string GetSetting(string fullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fullName | The full hierarchical key of the configuration setting (e.g., |
Returns
| Type | Description |
|---|---|
| string | The string value of the configuration setting, or null if the key does not exist. |
GetSetting<T>(string)
Retrieves a specific configuration setting value by its full key name.
Declaration
public T GetSetting<T>(string fullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fullName | The full hierarchical key of the configuration setting (e.g., |
Returns
| Type | Description |
|---|---|
| T | The value of the configuration setting converted to |
Type Parameters
| Name | Description |
|---|---|
| T | The type to convert the configuration value to. |