Class AchievementSessionGeneration
Counts how many times the achievement state has been wiped. Detached work captures the generation it started under and checks it again before writing, so a result that arrives after a reset is discarded instead of resurrecting the state it belonged to.
Inherited Members
Namespace: Serenity.Achievements.Application.Services
Assembly: Serenity.Achievements.Application.dll
Syntax
public class AchievementSessionGeneration
Remarks
A cancellation token alone is not enough here: a capture that already finished its await and is on its way to the store observes no cancellation, yet its write would still recreate a record the player just deleted. The generation check closes that window.
Constructors
AchievementSessionGeneration()
Declaration
public AchievementSessionGeneration()
Properties
Current
The generation detached work must still be running under to be allowed to write.
Declaration
public int Current { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Advance()
Invalidates every generation captured so far and returns the new one.
Declaration
public int Advance()
Returns
| Type | Description |
|---|---|
| int |
IsCurrent(int)
Whether a captured generation is still the current one.
Declaration
public bool IsCurrent(int capturedGeneration)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capturedGeneration | The generation captured when the work started. |
Returns
| Type | Description |
|---|---|
| bool |