-
Notifications
You must be signed in to change notification settings - Fork 0
Domain Modelling
alsi-lawr edited this page Jul 15, 2026
·
1 revision
BlokeBot uses native C# record unions for finite domain states and outcomes with more than two meaningful cases.
- Keep the union beside its owning domain rather than in a shared catalogue.
- Use a public abstract record with a private constructor.
- Represent cases as nested sealed records with get-only, case-local payloads.
- Provide an abstract typed
Matchhandler for every case. - Extend
Matchwhen adding a case so compiler errors identify every affected consumer.
- package or generator dependencies for the union;
- Boolean discriminators;
- enum-plus-null payload bags;
- wildcard/default handlers;
- fallback exceptions for declared cases.
The source note is docs/native-record-unions.md.