logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementStoreAccess

    The never-throwing face of IAchievementStore. Every call reports whether it worked instead of raising, so a backend outage degrades the aggregate rather than taking down whatever gameplay code happened to unlock an achievement.

    Inheritance
    object
    AchievementStoreAccess
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Application.Services
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public class AchievementStoreAccess
    Remarks

    A remote store is allowed to throw (see AchievementStoreException) and a local one is not, but the caller must behave the same either way, so the distinction is absorbed here once rather than at eight call sites. Cancellation is NOT absorbed: an OperationCanceledException means the caller asked to stop, which is not a store failure and must propagate.

    Constructors

    AchievementStoreAccess(IAchievementStore, ILogService)

    Initializes a new instance of the AchievementStoreAccess class.

    Declaration
    public AchievementStoreAccess(IAchievementStore store, ILogService logService)
    Parameters
    Type Name Description
    IAchievementStore store

    The backend store every call is forwarded to.

    ILogService logService

    Logging service. May be null.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when store is null.

    Methods

    TryClearAsync(PlayerId, CancellationToken)

    Removes every row for a player. Reports failure instead of throwing.

    Declaration
    public Task<bool> TryClearAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to clear.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>

    TryEnsureSchemaAsync(CancellationToken)

    Creates whatever schema the backend needs. Reports failure instead of throwing.

    Declaration
    public Task<bool> TryEnsureSchemaAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>

    TryGetProgressAsync(PlayerId, CancellationToken)

    Reads every progress row for a player, or null when the store could not answer.

    Declaration
    public Task<IReadOnlyList<AchievementProgress>> TryGetProgressAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to query.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<IReadOnlyList<AchievementProgress>>

    TryGetUnlocksAsync(PlayerId, CancellationToken)

    Reads every unlock record for a player, or null when the store could not answer.

    Declaration
    public Task<IReadOnlyList<AchievementUnlockRecord>> TryGetUnlocksAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player to query.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<IReadOnlyList<AchievementUnlockRecord>>

    TryUpsertProgressAsync(PlayerId, AchievementProgress, CancellationToken)

    Writes a progress row. Reports failure instead of throwing.

    Declaration
    public Task<bool> TryUpsertProgressAsync(PlayerId player, AchievementProgress progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player

    The player the progress belongs to.

    AchievementProgress progress

    The progress row to write.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>

    TryUpsertUnlockAsync(AchievementUnlockRecord, CancellationToken)

    Writes an unlock record. Reports failure instead of throwing.

    Declaration
    public Task<bool> TryUpsertUnlockAsync(AchievementUnlockRecord record, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    AchievementUnlockRecord record

    The record to write.

    CancellationToken cancellationToken

    Token used to cancel the operation.

    Returns
    Type Description
    Task<bool>
    In this article
    © 2026 Serenity. All Rights Reserved