↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Architecture Decision Record

ADR-104: Plain Enums by Default, Enumeration<T> as the Opt-In Smart-Enum Base

Status

Accepted (2026-08-31). Revised 2026-09-09: ADR-115 copies this record's posture verbatim for strongly typed identifiers: shipped, tested, wired into JSON, EF Core, MVC binding and OpenAPI, and adopted by nothing, with the cheap default left exactly where it is. Revised 2026-09-19: Context corrected to state what ValueObjectsAreImmutableSealedInShared actually asserts (sealed, Shared-layer assembly, no public mutable setters). The rule carries no record check. Revised 2026-10-07: Decision point 13 now separates code references from comment-only mentions of Enumeration<T>; adoption remains zero. Revised 2026-10-21: anchors refreshed after the Shared public-API baseline grew; the eighteen shipped declarations are unchanged. Revised 2026-10-26: Context and Decision point 11 no longer list the message-bus provider as a plain enum, because the MessageBusProvider enum was replaced by a string with built-in values on MessageBusProviders. Revised 2026-10-28: anchors refreshed after the Shared and Infrastructure public-API baselines moved; the eighteen shipped declarations are unchanged. Revised 2026-11-12: MMCA.Helpdesk is the first adopter (TicketLifecycle, a domain type behind the TicketStatus wire enum), and EnumerationNameValueConverter<T> is recorded beside the integer converter (Context, Decision points 9, 11, 12 and 13, Trade-offs). Revised 2026-11-23: the shipped surface is twenty declarations (fourteen in Shared, six in Infrastructure) and the Context counts forty test methods; AddAPI no longer registers a CurrencyJsonConverter (Currency carries its own attribute), and anchors are refreshed. Revised 2026-12-02: the two nullable converters (NullableEnumerationValueConverter<TEnumeration>, NullableStronglyTypedIdValueConverter<TSelf, TValue>) are removed and an optional column takes the plain converter; the read leg throws on a non-empty unknown stored value instead of materializing null (Context, Decision points 9, 10, 12 and 13, Trade-offs; see Revision (2026-12-02)).

Context

A bounded set of named values shows up everywhere in this workspace: the state that triggered a domain event, an error category, a rate-limiting algorithm, a JWT signing algorithm. The framework answers that need with an ordinary CLR enum. DomainEntityState (MMCA.Common/Source/Core/MMCA.Common.Domain/Enums/DomainEntityState.cs:7-13) is the canonical example, and it is the discriminator ADR-083 chose for the whole CRUD lifecycle taxonomy.

A CLR enum stops being enough at one specific point: when a member needs to carry behavior or data. A switch over an enum that appears in three places is the usual symptom, because the value has no home to hang a policy, a rate or a display rule on. The classic answer is the smart enumeration: a sealed class whose members are public static readonly fields, so each member is a real object.

The framework ships that base. Enumeration<TEnumeration> (MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Enumeration.cs:77-78) is complete rather than sketched: reflection-based member discovery, Result-returning lookups, type-guarded equality, a System.Text.Json converter factory, DataContract attribution for the XML formatter, and two EF Core value converters in Infrastructure. Forty test methods across three files pin its contract. It also sits in the MMCA.Common.Shared.ValueObjects namespace but deliberately does not derive from ValueObject. The ValueObjectsAreImmutableSealedInShared fitness rule asserts three things about every concrete class deriving from ValueObject: the type is sealed (ArchitectureRules.Immutability.cs:64), its assembly sits in the Shared layer (:67), and it declares no public property with a public mutable setter (:70, :76-79). Deriving would therefore pin every concrete enumeration to the Shared layer and to sealed, which is not where a consumer declares a per-module set. The remark on the type states the same three assertions and notes that the rule names no record and inspects no fields (Enumeration.cs:26-34), so nothing in it forbids the public static readonly field idiom the type exists for.

Adoption is one set, in the reference app. No production type in MMCA.Common, MMCA.Store or MMCA.ADC derives from Enumeration<T>; the reference app MMCA.Helpdesk's ticket lifecycle does (Decision point 13), and the only other derivations are five private fixtures inside the three test files. Every other bounded set the framework and its consumers declare is a plain C# enum. The string-keyed sibling RoleValue (MMCA.Common/Source/Core/MMCA.Common.Shared/Auth/RoleValue.cs:26), which takes the same not-a-ValueObject trade-off for a closed string set, does have a production derivation in ADC (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/UserRole.cs:18), so the idiom is not foreign here, and the integer-keyed base now has its one production set too.

That leaves two readings of the same code, and this record picks one. Either the choice between a plain enum and a smart enumeration is a decision worth writing down, with a stated rule for when each applies, or Enumeration<T> is dead public surface frozen by the ADR-015 public-API gate. This record takes the first reading and states the posture explicitly, the same "shipped in the framework, tested, latent until the first adoption" honesty ADR-037 records for the field-level encryption converter.

Decision

A plain C# enum is the default for a bounded set. Enumeration<T> is the opt-in base for a set whose members need behavior or data, and nothing in the framework pushes a consumer toward it.

  1. Plain enums stay the default, including on the framework's own hot paths. DomainEntityState is a four-member CLR enum (DomainEntityState.cs:7-13) and is the discriminator ADR-083's EntityChangedEvent<TId> carries across the wire. Nothing in this record proposes converting it or any other existing enum.

  2. The smart-enum base is a real closed type per enumeration. Enumeration<TEnumeration> where TEnumeration : Enumeration<TEnumeration> (Enumeration.cs:77-78) is self-referencing, so All, FromValue and FromName are per-type lookups with no type argument at the call site. A member carries a canonical Name (:101) and a stable integer Value (:105), set through the protected constructor (:93).

  3. Members are discovered by reflection, once, then frozen. DiscoverMembers reads the public static readonly fields declared directly on the closed type (BindingFlags.Public | Static | DeclaredOnly, :171-180, filter at :174-175), ordered by Value (:178). Three Lazy<> caches back it: the member list (:80), a FrozenDictionary<int, TEnumeration> by value (:82-83) and a case-insensitive FrozenDictionary<string, TEnumeration> by name (:85-88). Two members sharing a value or a name therefore fail when the lookup is first built rather than silently shadowing each other (documented at :36-40).

  4. Lookups return Result, not exceptions, matching ADR-013. FromValue fails with code Enumeration.UnknownValue (:121-131, code at :127) and FromName with Enumeration.UnknownName (:142-152, code at :148); FromName treats a null name as a lookup miss rather than throwing (:144).

  5. Equality is type-guarded and deliberately not IEquatable<T>. Equals compares the concrete type and the value (:158-161), GetHashCode combines both (:164), so two enumerations that happen to share an integer are never equal. The base declines IEquatable<T> because an unsealed implementation breaks the equality contract for subclasses (S4035), leaving a sealed derived type free to add its own (:42-48). ToString returns the name (:155).

  6. JSON is the member name, through a converter factory. EnumerationJsonConverterFactory (:201) converts only the self-referencing closed type, by walking the base chain and comparing the generic argument with the type itself (:204-205, :219-228). Its nested converter writes value.Name (:247-248) and reads a string back through FromName, throwing JsonException for a non-string token and for an unknown name (:233-245). HandleNull stays at its default, so a JSON null short-circuits before the converter runs (:195-199).

  7. The factory is registered once for the whole API surface. System.Text.Json resolves [JsonConverter] off the type being converted without walking base types, so the attribute on the base (:72) covers only a member typed as the base. AddAPI adds the factory to JsonSerializerOptions.Converters (MMCA.Common/Source/Presentation/MMCA.Common.API/DependencyInjection.cs:60, rationale at :57-59), beside the StronglyTypedIdJsonConverterFactory registration (:66), so a concrete enumeration serializes by name across every host that calls AddAPI with no per-type attribute. Currency takes the other route: it carries its converter as a type attribute (MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Financial/Currency.cs:15), so AddAPI does not register it.

  8. XML rides the DataContract attributes already on the type. The base is [DataContract] (Enumeration.cs:71) with [DataMember(Order = 1)] Name (:100) and [DataMember(Order = 2)] Value (:104), and AddAPI registers AddXmlDataContractSerializerFormatters() (DependencyInjection.cs:68).

  9. Persistence is a plain int column by default, or the member name where the column already holds names. EnumerationValueConverter<TEnumeration> is a ValueConverter<TEnumeration, int> writing member.Value and reading through FromValue (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/EnumerationValueConverter.cs:38-50, both legs at :46-47). The same converter serves an optional property, so there is no separate nullable converter: EF never passes a null to a converter that does not convert nulls, so a NULL column stays a null member and the reverse, and the optional column is mapped through the non-generic HasConversion(ValueConverter) overload plus IsRequired(false), because the generic overload compares the converter's non-nullable model type with the property's nullable one (:19-25). Beside it, EnumerationNameValueConverter<TEnumeration> is a ValueConverter<TEnumeration, string> writing member.Name and reading through FromName (:77-91). It fits a column that already holds names, such as a CLR enum mapped with HasConversion<string>(): the column stays text with the same stored values, so replacing that enum with a smart enumeration is neither a column type change nor a data rewrite, while an int column takes the integer converter (:52-58). FromName matches case-insensitively (:70). Mapping through HasConversion rather than OwnsOne keeps the backing column a plain int, so replacing a CLR enum property with a smart enumeration is not a schema change (:9-11). Column facets stay at the call site by design (:19-20). The read leg does not trust the column. A stored value no member declares throws InvalidOperationException naming the type and the value (:28-34), through the internal UnknownStoredValue.Throw on the right of a ??, since an expression tree cannot hold a throw (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/UnknownStoredValue.cs:17, :24-28; integer leg EnumerationValueConverter.cs:47, name leg :88). Only a value written outside EF can reach it. The name converter keeps one exception: empty text, which no member declares and the write leg never writes, still materializes a null member (:69-74, :86-87). The money mapping's currency column uses the same helper, reading an empty code as Currency.None and throwing on a non-empty unknown one (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/EntityTypeBuilderExtensions.cs:87-89).

  10. The contract is pinned by tests, not by adoption. EnumerationTests (MMCA.Common/Tests/Core/MMCA.Common.Shared.Tests/ValueObjects/EnumerationTests.cs:1-144, 15 test methods) covers both lookups, casing, null, per-type All scoping and cross-enumeration equality and hashing; EnumerationSerializationTests (.../ValueObjects/Serialization/EnumerationSerializationTests.cs:1-139, 11 methods) covers both routes to the converter and pins the documented limitation that an unattributed enumeration under unconfigured options falls back to the default object shape (:68-75); EnumerationValueConverterTests (MMCA.Common/Tests/Core/MMCA.Common.Infrastructure.Tests/Persistence/Conversions/EnumerationValueConverterTests.cs, 14 methods) covers the two converters, including the read-leg throw on an unknown stored value and a SQLite round-trip of the plain converter on an optional column mapped with IsRequired(false) (:234).

  11. The rule for choosing. Use a plain C# enum when the members are names for states or options and every decision about them is made by the code that reads them: it is the cheaper type, it needs no converter registration, and it is what ADR-083's discriminator, ErrorType, RateLimitAlgorithm and JwtSigningAlgorithm all are today. Reach for Enumeration<T> when a member must carry data or behavior (a rate, a policy, a display rule, a per-member override), when the same switch over the set is about to appear in a third place, or when the set needs Result-shaped parsing at a boundary. Declare the concrete type sealed with private constructors and public static readonly members, and map it with the framework value converter that matches the column: the integer converter for an int column, the name converter for one that already holds names (Decision point 9).

  12. The surface is frozen public API. Every member of the base and the factory is in MMCA.Common.Shared's shipped baseline (MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:986-991, :1351-1355, :1663-1665), and the two converters are in Infrastructure's (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:457-460): the name converter shipped with v1.289.0 (:457-458). The removed NullableEnumerationValueConverter still sits in that baseline (:463-464), with its removal recorded as *REMOVED* entries in PublicAPI.Unshipped.txt (:22-23) until the next release promotes it. Under ADR-015's RS0016/RS0017 gate, removing or reshaping any of it is a reviewable text diff and a breaking change to the package surface (the nullable converter's removal is one), which is precisely why leaving an unadopted capability in place is a decision rather than an oversight.

  13. Adoption is one set, in the reference app, and this record says so. No production type in MMCA.Common, MMCA.Store or MMCA.ADC derives from Enumeration<T>. MMCA.Helpdesk, the reference app and template source, declares one: TicketLifecycle (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Domain/Tickets/TicketLifecycle.cs:21), the ticket aggregate's status type (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Domain/Tickets/Ticket.cs:37). Its four members carry the lifecycle rule as data (IsLocked, true for Closed only, TicketLifecycle.cs:23-26, :31-35), and each member's value and name equal those of the TicketStatus enum (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Shared/Tickets/TicketStatus.cs:6, TicketLifecycle.cs:16-17). That enum stays the wire contract on purpose, so requests, responses, the UI and the cache keep sending numbers rather than the names the enumeration's JSON converter would write (TicketLifecycle.cs:12-16). The two meet at two points only: FromContract (:40) in the status handler (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Application/Tickets/UseCases/ChangeStatus/ChangeTicketStatusHandler.cs:57) and ToContract (TicketLifecycle.cs:44) in the DTO mapper and projector (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Application/Tickets/DTOs/TicketDTOMapper.cs:40, TicketDTOProjector.cs:41). The column is stored by name through the name converter with a 32-character limit (MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Infrastructure/Persistence/EntityConfiguration/TicketConfiguration.cs:44-47), the text it held when the property was the enum (:42-43), so the adoption needed no migration: the newest migration in the Tickets migrations project (20261112163619_AddWebhookSubscriptions) names no status column. Within MMCA.Common, the only code that references it is the base file itself, the EF converters, the AddAPI registration of its JSON converter factory (DependencyInjection.cs:19, :60) and the three test files. Everywhere else it appears only as text, in comments and in one SuppressMessage justification string, as the precedent the strongly typed identifiers and the entity base cite (for example IStronglyTypedId.cs:54, BaseEntity.cs:31, :50). Besides Helpdesk's set, the only derivations are the five private fixtures in those tests (EnumerationTests.cs:122, :134, EnumerationSerializationTests.cs:111, :122, EnumerationValueConverterTests.cs:275).

Rationale

  • The default should be the cheap type. A CLR enum costs nothing at a call boundary, needs no serializer or EF registration, and is what a .NET reader expects for a set of names. Making the smart enumeration the default would tax every bounded set in the workspace for a capability almost none of them use.
  • The expensive case still needs an answer. The reason a smart enumeration exists is that a plain enum forces behavior away from the value it belongs to. Having the base ready means the first set that needs per-member behavior does not arrive with a hand-rolled variant, its own JSON shape and its own HasConversion lambda pair.
  • Wire and schema compatibility is what makes the switch reversible. JSON is the member name and the column is a plain int, so a set that starts as a CLR enum serialized by name and stored by value can become a smart enumeration without a contract change or a migration (EnumerationValueConverter.cs:9-11).
  • A converter factory beats per-type attributes. Registering the factory once in AddAPI means a consumer's concrete enumeration is correct by default across every endpoint, instead of being correct only where someone remembered the attribute (DependencyInjection.cs:57-60).
  • Result lookups match the rest of the framework. FromValue/FromName returning Result<TEnumeration> (Enumeration.cs:121, :142) keeps parsing a value rather than an exception, which is ADR-013's posture and what every Create factory on a value object already does (ADR-068).
  • Recording an unadopted capability is cheaper than discovering it twice. ADR-037 made the same call for the encryption converter, and the payoff was concrete: the posture being explicit is what made it safe to replace that converter's format. The same applies here, and the alternative (deleting the type) costs a public-API break under ADR-015 for a capability that is complete and tested.

Trade-offs

  • A capability adopted only by the reference app is lightly stress-tested. The framework contract is pinned by 40 test methods against private fixtures, and its one production set is a four-member status in a sample app that keeps the enum on the wire (Decision point 13), so the JSON leg has no production user and no set has a long wire or migration history. Its ergonomics are demonstrated once rather than at scale.
  • Two answers to one question. A reader now has to choose between a plain enum and Enumeration<T>, and the rule in Decision point 11 is prose, not a fitness function. Nothing fails a build when a set that would benefit from behavior stays a switch, and nothing fails when a trivial set is declared as a smart enumeration.
  • Public API surface with one consumer. Eighteen declarations across two packages once the next release promotes the nullable converter's removal, fourteen in Shared (Shared/PublicAPI.Shipped.txt:986-991, :1351-1355, :1663-1665) and four in Infrastructure (Infrastructure/PublicAPI.Shipped.txt:457-460), are frozen under ADR-015 and can only be removed as a breaking change, the way the nullable converter was.
  • The JSON attribute does not inherit. A concrete enumeration serialized outside AddAPI's options (a hand-built JsonSerializerOptions, a System.Text.Json call in a test or a tool) falls back to the default object shape unless it repeats [JsonConverter] or registers the factory. That is a documented, tested limitation (Enumeration.cs:191-194, EnumerationSerializationTests.cs:68-75), not a defect, but it is a trap for the first adopter.
  • The EF read leg fails loudly, at the read. A row carrying a non-empty value no member declares throws InvalidOperationException when it is materialized (EnumerationValueConverter.cs:28-34, :47, :88), so one bad row fails the query that reads it, not only its own property. The write leg cannot produce such a row, so this is reachable only through a manual script, a data fix, or a member deleted from the enumeration after rows were written, and the message says to fix the row or restore the member (UnknownStoredValue.cs:26-28). Empty name text still reads as a null member, and an empty currency code as Currency.None (EntityTypeBuilderExtensions.cs:87-88).
  • Member discovery is reflection over declared fields. Members declared on an intermediate base are invisible by design (DeclaredOnly, Enumeration.cs:173), and a duplicate value or name is caught when the lookup is first built rather than at compile time, so a declaration bug surfaces at first use instead of in the editor.
  • The type sits in ValueObjects without being one. It lives in the MMCA.Common.Shared.ValueObjects namespace (Enumeration.cs:11) but is out of scope for ValueObjectsAreImmutableSealedInShared, which only inspects types deriving from ValueObject (MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Rules/Domain/ArchitectureRules.Immutability.cs:56-74, base-type filter at :61). The reason is documented on the type (Enumeration.cs:26-34), and RoleValue takes the same trade-off, but a reader scanning the namespace sees a type the value object rules do not cover.

Revision (2026-10-01)

No decision or rationale changed. The remark on Enumeration<TEnumeration> now states the same three assertions the Context lists and says the fitness rule names no record and inspects no fields (Enumeration.cs:26-34), so the Context no longer contrasts a sealed-record remark with the rule. The remark rewrite moved every later line in Enumeration.cs by five, and the anchors in Context, Decision, Rationale and Trade-offs are refreshed accordingly (declaration :76-77, member discovery :170-179, lookups :120-130 and :141-151, converter factory :200). Also refreshed: DependencyInjection.cs:54-67 (the StronglyTypedIdJsonConverterFactory registration now sits between the enumeration factory and the XML formatters), RoleValue.cs:26, UserRole.cs:18, and the PublicAPI.Shipped.txt ranges (Shared :542-547, :727-731, :943-945; Infrastructure :355-356, :359-360), which still hold eighteen declarations.

Revision (2026-10-06)

No decision, rationale or content changed.

  • The duplicate-detection remark in Enumeration.cs grew by one line (now :36-40), moving every later line by one, so the 2026-10-01 anchors recorded above are superseded by the ones in the live sections (declaration :77-78, member discovery :171-180, lookups :121-131 and :142-152, converter factory :201, IEquatable remark :42-48, usage note :191-194).
  • The PublicAPI.Shipped.txt ranges moved: Shared :567-572, :763-767, :991-993; Infrastructure :356-357, :360-361. They still hold eighteen declarations.
  • Anchors in Context, Decision, Rationale and Trade-offs were re-verified against current source; Enumeration.cs:11 and :26-34 are unchanged.

Revision (2026-10-07)

Re-verified against current source. No decision or rationale changed, and adoption is still zero: no type in MMCA.ADC, MMCA.Store or MMCA.Helpdesk derives from Enumeration<T>, and the only derivations in MMCA.Common remain the five private test fixtures. One statement corrected.

  1. Decision point 13 said the only types referencing Enumeration<T> at all were the base file, the EF converters, the AddAPI registration and the three test files. Code references are confined to those, but the type is also named as text elsewhere: the strongly typed identifier interface (MMCA.Common/Source/Core/MMCA.Common.Shared/Identifiers/IStronglyTypedId.cs:54), the entity base (MMCA.Common/Source/Core/MMCA.Common.Domain/Entities/BaseEntity.cs:31, plus a SuppressMessage justification string at :50), the strongly typed identifier fitness rule (MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Rules/Domain/ArchitectureRules.StronglyTypedIds.cs:30) and two identifier tests (MMCA.Common/Tests/Core/MMCA.Common.Shared.Tests/Identifiers/TestIdentifiers.cs:8, StronglyTypedIdSerializationTests.cs:99). None is a code dependency; Decision point 13 now says so.
  2. Anchors re-verified against current source: DependencyInjection.cs:59 (factory registration), EnumerationTests.cs:122, :134, EnumerationSerializationTests.cs:111, :122 and EnumerationValueConverterTests.cs:89 (the five fixtures), all unchanged.

Revision (2026-10-21)

Re-verified against current source. No decision, rationale or content changed, and the shipped surface still holds eighteen declarations; only the Shared public-API anchors moved. No PublicAPI.Unshipped.txt carries an Enumeration entry.

  1. Anchors re-verified against current source: in Decision point 12 and the Trade-offs, the Shared override block (Equals, GetHashCode, ToString, CanConvert, CreateConverter) now sits at MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:766-770 and the static block (All, FromName, FromValue) at :994-996. Unchanged: Shared :567-572 and Infrastructure MMCA.Common/Source/Core/MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:356-357, :360-361.

Revision (2026-10-26)

Re-verified against current source. No decision or rationale changed, and adoption is still zero. One example, in the Context and in Decision point 11, is corrected.

  1. The Context and Decision point 11 listed the message-bus provider (MessageBusProvider) among the plain C# enums. That was true when written; the enum has since been replaced by a string (MMCA.Common/UPGRADING.md:120, :169). The provider is now MessageBusSettings.Provider (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Messaging/MessageBusSettings.cs:25), whose three built-in values are string constants on the static class MessageBusProviders (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Messaging/Transports/MessageBusProviders.cs:10, constants at :16, :19, :27) matched through IsInProcess, IsRabbitMq and IsPostgreSql (:44, :50, :56); any other value names an IBrokerTransport an adapter package registers (AzureServiceBus and AmazonSqs are listed in the internal KnownAdapterTransports dictionary at :34-39). The Context no longer names it among the bounded sets, and Decision point 11 now names only the plain enums: ADR-083's discriminator (DomainEntityState), ErrorType, RateLimitAlgorithm and JwtSigningAlgorithm.
  2. Anchors re-verified against current source: ErrorType (MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/ErrorType.cs:10), RateLimitAlgorithm (MMCA.Common/Source/Presentation/MMCA.Common.API/RateLimiting/RateLimitAlgorithm.cs:8) and JwtSigningAlgorithm (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/JwtSigningAlgorithm.cs:21) are still plain enums.

Revision (2026-10-28)

Re-verified against current source. No decision, rationale or content changed, adoption is still zero, and the shipped surface still holds eighteen declarations (fourteen in Shared, four in Infrastructure); only the public-API anchors moved. The anchors recorded in the 2026-10-21 revision above are superseded by the ones below and in the live sections.

  1. Anchors re-verified against current source, in Decision point 12 and the Trade-offs: the Shared type block (base type, constructor, Name, Value, factory type, factory constructor) now sits at MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:578-583, the override block (Equals, GetHashCode, ToString, CanConvert, CreateConverter) at :780-784 and the static block (All, FromName, FromValue) at :1016-1018; Infrastructure's EnumerationValueConverter at MMCA.Common/Source/Core/MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:347-348 and NullableEnumerationValueConverter at :351-352.

Revision (2026-11-23)

Re-verified against current source. No decision or rationale changed, and adoption is still the one Helpdesk set. Three statements are corrected and the anchors that moved are re-pointed.

  1. The shipped surface is twenty declarations, not eighteen: fourteen in Shared (MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:986-991, :1351-1355, :1663-1665) and six in Infrastructure (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/PublicAPI.Shipped.txt:378-381, :384-385). The name converter added in v1.289.0 (MMCA.Common/CHANGELOG.md:511, :537) brought the two extra declarations (:378-379). No PublicAPI.Unshipped.txt under Source/Core carries an Enumeration entry. The Trade-offs and Decision point 12 now cite the same ranges.
  2. The Context said thirty-three test methods pin the contract; the three files hold forty (EnumerationTests.cs 15, EnumerationSerializationTests.cs 11, EnumerationValueConverterTests.cs 14), matching Decision point 10 and the Trade-offs. Decision point 10 now says EnumerationValueConverterTests covers the three converters, since its name converter section starts at :90, and the Context lists three EF Core value converters rather than a pair.
  3. Decision point 7 cited a CurrencyJsonConverter registration in AddAPI as the precedent for the factory. AddAPI's AddJsonOptions block registers only the enumeration and strongly typed identifier factories (MMCA.Common/Source/Presentation/MMCA.Common.API/DependencyInjection.cs:55-67), and Currency carries its converter as a type attribute (MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Financial/Currency.cs:15, class at :75), as the AddAPI summary says (DependencyInjection.cs:31-32).
  4. Anchors re-verified against current source: DependencyInjection.cs:19 (alias, unchanged), :60 (factory registration, rationale :57-59), :68 (XML formatters); EnumerationValueConverterTests.cs:71-79 (null pass-through), :215 (fixture, unchanged); MMCA.Helpdesk/Source/Modules/Tickets/MMCA.Helpdesk.Tickets.Domain/Tickets/Ticket.cs:37 (the Status property); EnumerationTests.cs:122, :134 and EnumerationSerializationTests.cs:111, :122 (fixtures, unchanged).

Revision (2026-12-02)

Two decisions are reversed. The plain-enum default, the choosing rule and the posture are unchanged, adoption is still the one Helpdesk set, and the integer EnumerationValueConverter<TEnumeration> stays the default converter for an int column. The live Status, Context, Decision points 9, 10, 12 and 13 and the Trade-offs were corrected; the dated revisions above record the code as it stood then (including the NullableEnumerationValueConverter anchors of the 2026-10-28 pass, the twenty declarations of the 2026-11-23 pass, and its null pass-through test anchor EnumerationValueConverterTests.cs:71-79).

  1. The two nullable converters are removed. NullableEnumerationValueConverter<TEnumeration> and NullableStronglyTypedIdValueConverter<TSelf, TValue> are gone from source; their removal is recorded as *REMOVED* entries (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/PublicAPI.Unshipped.txt:22-25) against the shipped baseline (PublicAPI.Shipped.txt:463-466). An optional enumeration column maps through the plain converter, .HasConversion((ValueConverter)new EnumerationValueConverter<T>()).IsRequired(false) (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/EnumerationValueConverter.cs:19-25), pinned by a SQLite round-trip of a nullable column (MMCA.Common/Tests/Core/MMCA.Common.Infrastructure.Tests/Persistence/Conversions/EnumerationValueConverterTests.cs:234). For a strongly typed identifier (ADR-115) EF lifts the plain struct converter over Nullable<T>. Once the next release promotes the removal, Infrastructure's share of the surface is four declarations (PublicAPI.Shipped.txt:457-460) and the total eighteen.
  2. The read leg throws on a non-empty unknown stored value. The Trade-offs entry "The EF read leg trusts the column", which accepted a null reference for a value no member declares, is reversed. The integer leg (EnumerationValueConverter.cs:47), the name leg (:88) and the money mapping's currency column (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/EntityTypeBuilderExtensions.cs:89) call UnknownStoredValue.Throw (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/UnknownStoredValue.cs:24-28), which throws InvalidOperationException naming the type and the value: the same verdict the JSON converter gives for an unknown name (Decision point 6). A bad row surfaces at the read instead of as a NullReferenceException or a silently wrong aggregate far from it (UnknownStoredValue.cs:3-9). Empty name text still materializes null (EnumerationValueConverter.cs:86-87), and an empty currency code reads as Currency.None (EntityTypeBuilderExtensions.cs:87-88).
  3. EnumerationValueConverterTests still holds 14 test methods: the nullable-converter tests are gone, and the read-leg throw and the optional-column round-trip replace them. The fixture moved to EnumerationValueConverterTests.cs:275.

ADR-037 (the precedent for recording a shipped, tested and unadopted framework capability as a decision rather than leaving it to read as unfinished adoption), ADR-068 (the seven sealed record value objects over the ValueObject base, whose fitness rule is exactly what Enumeration<T> declines to sit under, and whose Result-returning Create factories are the parsing shape FromValue/FromName follow), ADR-083 (the plain-enum discriminator: DomainEntityState is the default choice this record keeps, and it rides integration events as a frozen wire field), ADR-015 (the RS0016/RS0017 public-API baseline that freezes this surface and makes leaving it in place a decision with a stated cost), ADR-013 (the Result posture the lookups follow instead of throwing), ADR-018 (the other shipped-but-latent record ADR-037 cites for the same posture).