DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AppSettingStore

    Azure Cosmos DB app setting store implementation. Manages persistence and retrieval of application settings from the database with caching support.

    Inheritance
    object
    AppSettingStore
    Implements
    IAppSettingStore
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Setting.AzureCosmosDB
    Assembly: DataWeb.Data.AzureCosmosDB.dll
    Syntax
    public class AppSettingStore : IAppSettingStore

    Constructors

    AppSettingStore(ICosmosHelper, IConfigurationService, ICacheService)

    Azure Cosmos DB app setting store implementation. Manages persistence and retrieval of application settings from the database with caching support.

    Declaration
    public AppSettingStore(ICosmosHelper cosmosHelper, IConfigurationService configurationService, ICacheService cacheService)
    Parameters
    Type Name Description
    ICosmosHelper cosmosHelper
    IConfigurationService configurationService
    ICacheService cacheService

    Properties

    Name

    Gets the name of the store.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    Methods

    ExistsAsync(string, CancellationToken)

    Checks whether a setting with the specified name exists in the database.

    Declaration
    public Task<bool> ExistsAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    Setting name. Cannot be null or empty.

    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<bool>

    true if the setting exists; otherwise false.

    Exceptions
    Type Condition
    ArgumentException

    If name is null or empty.

    GetSettingAsync(string, CancellationToken)

    Retrieves a single setting value by name.

    Declaration
    public Task<string> GetSettingAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    Setting name. Cannot be null or empty.

    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<string>

    The setting value, or null if the setting does not exist.

    Exceptions
    Type Condition
    ArgumentException

    If name is null or empty.

    GetSettingsAsync(CancellationToken)

    Retrieves all application settings from the database.

    Declaration
    public Task<IEnumerable<AppSetting>> GetSettingsAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<IEnumerable<AppSetting>>

    Collection of all application settings.

    GetSettingsCachedAsync(CancellationToken)

    Retrieves all application settings from cache, or from the database if not cached.

    Declaration
    public Task<IEnumerable<AppSetting>> GetSettingsCachedAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<IEnumerable<AppSetting>>

    Collection of all application settings.

    RemoveAsync(string, CancellationToken)

    Removes an application setting from the database, then invalidates the cache.

    Declaration
    public Task RemoveAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    Setting name. Cannot be null or empty.

    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    If name is null or empty.

    SetAsync(string, string, CancellationToken)

    Saves or updates an application setting, then invalidates the cache.

    Declaration
    public Task SetAsync(string name, string value, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    Setting name. Cannot be null or empty.

    string value

    Setting value.

    CancellationToken cancellationToken

    Token to cancel the asynchronous operation.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    If name is null or empty.

    Implements

    IAppSettingStore
    In this article
    Back to top Generated by DocFX