Class AppSettingService
Provides methods for managing application settings.
Implements
Inherited Members
Namespace: DataWeb.Setting
Assembly: DataWeb.Core.dll
Syntax
public class AppSettingService : IAppSettingService
Remarks
Initializes a new instance of the AppSettingService class.
Constructors
AppSettingService(IAppSettingStore)
Provides methods for managing application settings.
Declaration
public AppSettingService(IAppSettingStore appSettingStore)
Parameters
Type | Name | Description |
---|---|---|
IAppSettingStore | appSettingStore | An instance of the IAppSettingStore interface. |
Remarks
Initializes a new instance of the AppSettingService class.
Methods
ExistsAsync(string, CancellationToken)
Checks whether an application setting with the specified name exists.
Declaration
public Task<bool> ExistsAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the setting to check. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if the setting exists, otherwise false. |
GetSettingAsync(string, CancellationToken)
Retrieves the value of the application setting with the specified name.
Declaration
public Task<string> GetSettingAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the setting. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | The value of the setting as a string. |
GetSettingsAsync(CancellationToken)
Retrieves all application settings.
Declaration
public Task<IEnumerable<AppSetting>> GetSettingsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<AppSetting>> | A collection of AppSetting objects. |
RemoveAsync(string, CancellationToken)
Removes the application setting with the specified name.
Declaration
public Task RemoveAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the setting to remove. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetAsync(string, string, CancellationToken)
Sets the value of an application setting with the specified name.
Declaration
public Task SetAsync(string name, string value, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the setting to set. |
string | value | The value to set the setting to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |