Class BetaCodeEntity
A beta code: one admission ticket, possibly multi-use, to a named test program.
public class BetaCodeEntity
- Inheritance
-
BetaCodeEntity
- Inherited Members
Remarks
Codes are minted in batches under a program (alpha, closed-beta, a private
test). While beta mode is on, only an account linked to a live code of an active program may
register or sign in; see AccountBetaCodeEntity for the link.
Codes are revoked, never deleted. A code row is what every account link points at, and deleting one would leave links recording an admission to a program nobody can look up. Revocation keeps the row and ends the access it granted.
Redemption does not rely on the xmin token. It is one conditional UPDATE —
use_count < max_uses, not revoked, not expired — whose WHERE clause is the
concurrency control, so two accounts racing for the last use cannot both get it. The token
is there for staff edits made through EF, which would otherwise overwrite a redemption that
landed between their read and their save.
Properties
Code
The code in XXXX-XXXX-XXXX form. Unique.
public string Code { get; set; }
Property Value
CreatedBy
The staff account that minted it.
public string CreatedBy { get; set; }
Property Value
CreatedUtc
When it was minted.
public DateTime CreatedUtc { get; set; }
Property Value
ExpiresUtc
When the code stops being redeemable, or null for never.
public DateTime? ExpiresUtc { get; set; }
Property Value
Remarks
Expiry ends redemption, not access: an account that redeemed the code before it expired keeps its place in the program. A tester admitted in March must not be locked out in April because the batch they were handed had a deadline for signing up.
ID
Surrogate key.
public long ID { get; set; }
Property Value
MaxUses
How many distinct accounts may redeem the code.
public int MaxUses { get; set; }
Property Value
Note
Free-text staff note, such as where the batch was handed out.
public string? Note { get; set; }
Property Value
Program
The program the code admits to, lowercase.
public string Program { get; set; }
Property Value
RevokedBy
The staff account that revoked it.
public string? RevokedBy { get; set; }
Property Value
RevokedUtc
When staff revoked the code, or null. Revocation ends redemption and access alike.
public DateTime? RevokedUtc { get; set; }
Property Value
UseCount
How many accounts have redeemed it. Only ever moved by the conditional redemption UPDATE.
public int UseCount { get; set; }
Property Value
Version
PostgreSQL xmin concurrency token.
public uint Version { get; set; }