logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementEvaluatorRestoration

    Hands the evaluator the condition state a service's local cache holds, exactly once, as soon as that cache is hydrated.

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

    The evaluator stays paused until it is restored, and a restore needs only the stored tallies — nothing from the storefront. The load that hydrates them, though, goes on to ask the platform account, and a gateway whose session arrives through a callback (Steam) can keep that load open for seconds. Restoring after LoadAsync(CancellationToken) returned would keep every signal and tick in that window evaluating nothing, so this restores on CacheHydrated and offers RestoreOnce() as the fallback for a load that ended without hydrating, which still has to start the evaluator.

    Constructors

    AchievementEvaluatorRestoration(AchievementService, AchievementEvaluator, ILogService)

    Starts listening for the service's cache to be hydrated.

    Declaration
    public AchievementEvaluatorRestoration(AchievementService service, AchievementEvaluator evaluator, ILogService logService)
    Parameters
    Type Name Description
    AchievementService service

    The service whose local cache holds the stored condition state.

    AchievementEvaluator evaluator

    The paused evaluator to restore.

    ILogService logService

    Logging service. May be null.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the service or the evaluator is null.

    Properties

    HasRestored

    Whether the evaluator has been restored.

    Declaration
    public bool HasRestored { get; }
    Property Value
    Type Description
    bool

    Methods

    Dispose()

    Stops listening for the service's cache to be hydrated.

    Declaration
    public void Dispose()

    RestoreOnce()

    Restores the evaluator from whatever the service's cache holds, doing nothing when it was restored already — a second restore would overwrite tallies the running evaluator has moved on from.

    Declaration
    public void RestoreOnce()
    Remarks

    Guarded on its own: nobody awaits the load chain this runs in, so an exception escaping here would be swallowed by the task and the session would silently run on half-restored counters with no trace of why.

    Implements

    IDisposable
    In this article
    © 2026 Serenity. All Rights Reserved