Architecture Decision Record
ADR-068: Value Objects as Validated Domain Primitives
Status
Accepted (2026-08-07). Revised 2026-08-31 (Money's non-validating construction paths named, Currency's
converter counted among the serialization annotations, Address added to the adopted set, and the Store/ADC
anchors refreshed). Revised 2026-09-03: Event.OrganizerContactEmail became Email?, the third ADC
adoption site, so ADC's Domain now holds no primitive email property and matches Store on that count (superseded 2026-11-23: Engagement's Ticket.OrderEmail
is a primitive email, see Revision below);
the record also notes why the validator, the length invariant and the column shape were all left
alone, following the Speaker precedent.
Revised 2026-09-25 (the shipped OwnsAddress helper named beside OwnsMoney: Store's Customer.Address
maps through it; the Store, ADC and EntityTypeBuilderExtensions anchors refreshed). As of
2026-10-01 Store follows that call with a second OwnsOne block that overrides the helper's unicode
facet (superseded 2026-10-21: that block is gone), and the with-expression path around the Money sugar is named (see Revision below).
Revised 2026-10-06: a serialized Money.Zero() now JSON round-trips, because both currency converters (superseded 2026-11-23: only the converter on the type remains) read the empty code back as the sentinel and Money's JSON read refuses that sentinel beside a non-zero amount, so the 2026-10-01 round-trip flag is resolved; anchors refreshed. Revised 2026-10-07: anchors refreshed after the v1.233.0 release.
Revised 2026-10-19: the primitive Start/End exception names Store's discount window beside ADC's pairs, and the order rule is named per entity (Session uses its own strict-after rule).
Revised 2026-10-21: OwnsAddress keeps the provider's Unicode default on its six columns (v1.247.0) and Store's Customer.Address maps through it alone, with no second OwnsOne override block; anchors refreshed.
Revised 2026-10-26: anchors refreshed after the v1.248.0 through v1.261.0 releases.
Revised 2026-10-28: Store's adoption now names Order's four mapped Money values, the Order shipping and billing Address mappings and the primitive guest Order.ContactEmail, and the Money JSON constructor's missing-currency refusal (v1.261.0) is recorded; anchors refreshed.
Revised 2026-11-23: Currency has a single JSON converter since v1.304.0 removed the API-layer one, AddAPI registers no value-object JSON converter, ADC's Ticket.OrderEmail is recorded as a primitive email beside Store's Order.ContactEmail, and ADC's four User factories are named; anchors refreshed.
Revised 2026-11-30: DateRange, DateTimeRange and PhoneNumber (with PhoneNumberInvariants and both phone converters) are removed in MMCA.Common v1.323.0, leaving four value objects, each with a production consumer; see Revision below.
Revised 2026-11-30 (v1.324.0): EmailRules<T> and the UI's OptionalEmailAttribute check the format
through EmailInvariants.EnsureEmailIsValid, the Email factory's own check, and fail under its code
Email.InvalidFormat; rule sets take a codePrefix for per-rule codes, and FluentValidation's default
codes never reach the wire; see Revision (2026-11-30, v1.324.0) below.
Context
A domain model has two kinds of small type: the identity of a thing, and a value the thing
carries. ADR-048 recorded the identity half: identifiers stay primitives named through a global-using
alias, and the strongly-typed wrapper struct was considered and rejected because an identifier crosses
EF keys, JSON payloads, OpenAPI schemas, proto messages and URLs constantly, where a wrapper buys
converters at every hop and no invariant in return. ADR-115 later added the wrapper struct as an
opt-in framework capability (its JSON converter factory is registered in AddAPI at
Source/Presentation/MMCA.Common.API/DependencyInjection.cs:66) while keeping the aliases the
default, so ADR-048's verdict still governs identifiers unless a team opts in.
The value half was never recorded, even though the framework ships a full set of them in
Source/Core/MMCA.Common.Shared/ValueObjects/ and both production apps consume them. Left as bare
primitives, an email is a string that every caller re-validates, a price is a decimal whose
currency lives in a second column that nothing keeps in step, and a range is two dates with the
ordering rule restated per aggregate. These are exactly the cases a wrapper earns its cost: the type
exists to make the invariant unforgeable, not to rename a primitive.
So the workspace makes the opposite call for values that it makes for identifiers, and the asymmetry is the decision worth recording.
Decision
Model a domain value that carries an invariant as an immutable record value object with a
Result-returning factory; keep identifiers primitive (ADR-048).
- One abstract record base, and structural equality is the whole of it.
ValueObjectis a memberlesspublic abstract record(Source/Core/MMCA.Common.Shared/ValueObjects/ValueObject.cs:8): noGetEqualityComponents()override, no hand-writtenEquals/GetHashCode, because the record compiler generates equality over the declared properties. Four sealed types derive from it:Address(Address.cs:16),Currency(Currency.cs:16),Email(Email.cs:16) andMoney(Money.cs:22). - The constructor is private; the factory returns
Result<T>.Email.Create(Email.cs:30),Address.Create(Address.cs:69) andMoney.Create(Money.cs:91) are the validating entrance, and forEmailandAddressthey are also the only public entrance at all;Currencyis a closed set resolved byCurrency.FromCode(Currency.cs:43). This is ADR-013 applied below the aggregate: an invalid value is a failedResult, never an exception and never a constructed-but-wrong instance.Moneyis the exception, deliberately: it also exposes construction sugar that composes already-valid parts and so skipsCreateentirely,Money.Zero()(Money.cs:166),Money.Zero(Currency)(:171),operator *(:120-121) andMultiply(:148). The fitness rule below governs theCreatename only and says so in its own contract (ArchitectureRules.Entities.cs:49-51), so nothing stops a value object from shipping such a path. The sugar itself takes no raw string, and theNonesentinel isinternal(Currency.cs:25), but that does not makeCurrencysealed against unchecked values:Currency.Code(Currency.cs:36) andMoney.Amount/Money.Currency(Money.cs:32,36) are publicinitaccessors, shipped in the public API with the two record clone methods (Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:994,1000,1002,1356,1362), so an externalwithexpression (Currency.Usd with { Code = "XYZ" },Money.Zero() with { Amount = 5m }) produces a currencyFromCodenever checked or a non-zeroNone-currencyMoneywithout going throughCreate. The JSON guard described under serialization below does not close this path, because it runs only when a payload is deserialized. - That factory shape is fitness-enforced, not conventional.
ArchitectureRules.DomainFactoriesReturnResult(Source/Hosting/MMCA.Common.Testing.Architecture/Rules/Domain/ArchitectureRules.Entities.cs:53-79) walks every concrete class in the Domain and Shared layers and fails the build when a public staticCreateexists with no overload returningResult<TSelf>, generalizing the aggregate-root rule to value objects, following the ADR-015 fitness-function approach. - Shared constraints live in a static
*Invariantsclass beside the type.EmailInvariants.EnsureEmailIsValid(EmailInvariants.cs:23) andAddressInvariants.EnsureAddressLine1IsValid(AddressInvariants.cs:50, composed throughResult.CombineatAddress.cs:77-78) hold the checks, and the same classes own the length constants that EF configurations and FluentValidation validators reuse instead of restating:EmailInvariants.MaxLength(EmailInvariants.cs:14) and the six address field lengths (AddressInvariants.cs:12-27). The split is applied where the constraint is shared, not universally:MoneyandCurrencykeep their checks inline in the factory (Money.cs:95-96,Currency.cs:45-50). - Two EF mapping shapes, chosen by whether adoption is a schema change. A multi-field value maps as
an owned type: the shipped
OwnsMoneyhelper (Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/EntityTypeBuilderExtensions.cs:63) flattensMoneyinto adecimal(18,2)amount column (precision pinned at:78) plus a three-character non-unicode ISO 4217 code column (:76-88) and sets the navigation's requiredness from one parameter (:91). Its siblingOwnsAddress(:133, shipped in v1.192.0,MMCA.Common/CHANGELOG.md:2978) flattensAddressinto six columns whose lengths come fromAddressInvariantsand of which onlyAddressLine1is required (:142-168); they keep the provider's Unicode default (nvarcharon SQL Server), becauseAddressaccepts free text in any script (contract at:114-118; the forced non-unicode facet was removed as a breaking change in v1.247.0,MMCA.Common/CHANGELOG.md:1265). It names the columns from an optional prefix (AddressLine1,AddressCity, and so on by default,:135, joined at:187-190) and defaults the navigation to optional (:136, applied at:170). A single-string value maps throughHasConversioninstead, so the backing column stays a plain string column and adopting the value object on a property that used to be astringis not a migration:EmailValueConverterandNullableEmailValueConverter(Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/EmailValueConverter.cs:33,60). Column facets stay at the call site. Currency.Noneis a sentinel, and materialization never yields null. The sentinel isinternal static readonly Currency None = new(string.Empty)(Currency.cs:25);Money.Zero()carries it (Money.cs:166),Money.Createrejects it so an external caller must always name a real currency (Money.cs:95-96), and addition treats it as the identity element so a zero seed can accumulate into any currency (Money.cs:155-162). Because the write leg can therefore persist an empty code,OwnsMoney's read leg falls back to the sentinel rather than a null-forgiving.Value!(EntityTypeBuilderExtensions.cs:26,84, contract documented at:38-45), and the fallback is regression-covered (Tests/Core/MMCA.Common.Infrastructure.Tests/Persistence/Configuration/OwnsMoneyTests.cs:120).- Every serialization boundary is declared explicitly.
Money,EmailandAddressare[DataContract]with ordered[DataMember]members (Money.cs:21,31,35,Email.cs:15,19,Address.cs:15,19-40) and each carries a private[JsonConstructor]round-trip constructor (Money.cs:55,Email.cs:22,Address.cs:42) so a materializer rebuilds the value without reopening the factory;AddAPIregisters the XMLDataContractSerializerformatters (Source/Presentation/MMCA.Common.API/DependencyInjection.cs:68) and no JSON converter for these value objects: itsAddJsonOptionsblock (:55-67) adds only the enumeration and strongly-typed identifier factories (:60,:66).Currencyinstead serializes as its bare code through the one converter attached to the type itself (Currency.cs:15,75), which serves MVC model binding and the non-MVC paths (cache, outbox, integration events, typed clients) alike, so they all fail the same way (Currency.cs:67-68). That converter reads an empty code back as theNonesentinel (Currency.cs:88-89), so a serializedMoney.Zero()round-trips. Because the[JsonConstructor]bypassesCreate,MoneyimplementsIJsonOnDeserialized(Money.cs:22,76-82) and throwsJsonExceptionwhen a non-zero amount arrives with the sentinel (shipped in v1.232.0,MMCA.Common/CHANGELOG.md:1569), and the[JsonConstructor]itself throwsJsonExceptionwhen the currency is missing ornull(Money.cs:55-61, shipped in v1.261.0,MMCA.Common/CHANGELOG.md:997), so a malformed payload is a 400 rather than a 500 from anArgumentNullException. - gRPC is mapped by hand, not inferred.
Moneycrosses a service boundary as a purpose-builtMoneyV1message with a string amount (proto has no decimal) and a currency code (MMCA.Store/Source/Services/MMCA.Store.Catalog.Contracts/Protos/product_variants.proto:115,117,120), translated byMoneyFromWire(MMCA.Store/Source/Services/MMCA.Store.Catalog.Contracts/ProductVariantServiceGrpcAdapter.cs:190) andMoneyToWire(:221).MoneyFromWirehonors the empty-code sentinel only when the amount is also zero (:199-204) and returns null for a malformed entry, which the calling loop skips rather than failing the whole batch (:121-125). - Adoption is real but partial. Store maps
ProductVariant.Price(MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Domain/Products/ProductVariant.cs:30) withOwnsMoney(.../Catalog.Infrastructure/Persistence/EntityConfiguration/ProductVariantConfiguration.cs:40), andOrder.Total(MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Domain/Orders/Order.cs:140) with itsSubtotal,ShippingCostandTaxAmountsiblings (:143,146,149) are all seeded withMoney.Zero()in the private constructor (:297, seeds at:300-303). Once the lines are added,CreateCore(:369) re-seeds three of them:Subtotalbecomes a copy ofTotal, andShippingCostandTaxAmountbecome zeros in the order's own currency (Money.Zero(order.Total.Currency), not theCurrency.Nonesentinel;:423-425).Totalaccumulates throughMoney.Addas lines are added (:412, assigned back at:416) and is recomposed byApplyCharges(:524) as subtotal plus shipping plus tax, again throughMoney.Add(:544,:548, assigned at:556). All four maprequired: false(OrderConfiguration.cs:103,108-110) alongsideOrderLine.UnitPrice(OrderLineConfiguration.cs:28) andOrderLine.ListPrice(MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Domain/Orders/OrderLine.cs:42, mapped atOrderLineConfiguration.cs:33). Store Sales also typesOrder.ShippingAddressandOrder.BillingAddressas the frameworkAddress(Address?,Order.cs:99,103) and maps them throughOwnsAddresswith theShippingandBillingcolumn prefixes (OrderConfiguration.cs:38-39; theShippingLine1,BillingCityand sibling columns arrive in migrationSource/Hosting/MMCA.Store.Migrations.SqlServer.Sales/Migrations/20261025021650_AddGuestOrdersAndShippingLabels.cs). Store Identity typesCustomer.Addressas the frameworkAddress(MMCA.Store/Source/Modules/Identity/MMCA.Store.Identity.Domain/Customers/Customer.cs:40) and mapsCustomer.EmailthroughEmailValueConverter(CustomerConfiguration.cs:34) withCustomer.Addressthrough the shippedOwnsAddresshelper under its default prefix (CustomerConfiguration.cs:42), as the customer's onlyAddressmapping, andUser.Emailthe same way asCustomer.Email(UserConfiguration.cs:35-36). Store keeps one primitive email: the guest order'sOrder.ContactEmailis astring?(Order.cs:87) stored as a plain string column (OrderConfiguration.cs:28-30) and checked byOrderInvariants.EnsureContactEmailIsValid(.../Sales.Domain/Orders/OrderInvariants.cs:175-186), which callsEmail.Create(:180) but keeps the string. ADC typesUser.EmailasEmail(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/User.cs:56), and every factory that builds aUservalidates throughEmail.Createbefore the constructor:Create(:218,Email.Createat:226, constructor at:243), the social-login pathCreateExternal(:269,:277,:289),CreateFromInvitation(:318,:320) andCreateServiceAccount(:356,:359). It maps with the same converter (.../Identity.Infrastructure/.../UserConfiguration.cs:21), and ADC maps two optional Conference emails throughNullableEmailValueConverter: a speaker's (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Speakers/Speaker.cs:41, mapped at.../Conference.Infrastructure/Persistence/EntityConfiguration/Speakers/SpeakerConfiguration.cs:43) and an event's organizer contact (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Events/Event.cs:59, validated throughEmail.Createon both the create and update paths (:186-194,:264-272) and assigned at:144,292, mapped at.../Conference.Infrastructure/Persistence/EntityConfiguration/Events/EventConfiguration.cs:64-66). ADC still keeps one primitive email, the same shape as Store's guest-orderContactEmailnamed above: Engagement'sTicket.OrderEmailis astring?(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:73), validated throughEmail.Create(Tickets/TicketInvariants.cs:130,Ticket.cs:372) but stored and carried as a string. A Conference question answer of email type is likewise accepted or refused throughEmail.Createand stored as submitted (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Questions/QuestionInvariants.cs:182-187), but it is a generic answer value, not an email property. For the organizer contact itself, two details are worth recording because they look like leftovers and are not: the column is unchanged (nvarchar(255), still nullable) so the conversion needed no migration, andEventOrganizerContactEmailRules(.../Conference.Application/Events/Validation/EventValidationRules.cs:115, included at:242) plusEventInvariants.OrganizerContactEmailMaxLength(.../Conference.Domain/Events/EventInvariants.cs:39) were both kept, exactly as the Speaker precedent kept its own: the request-side validator still guards the wire string before it reachesEmail.Create, and the length invariant still drives the column width. The DTO maps back out throughEventDTOMapper.NullableEmailToString(.../Conference.Application/Events/DTOs/EventDTOMapper.cs:55), the twin of the speaker mapper's (.../Speakers/DTOs/SpeakerDTOMapper.cs:65).Money,EmailandAddressare adopted, withCurrencyriding along insideMoney, so every value object the framework ships has a production consumer; MMCA.Helpdesk adopts none of them at all. Documented exception (ADC, user decision 2026-10-06). ADC'sEvent.VenueAddressandActivity.VenueAddress(MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Events/Event.cs:45,Activities/Activity.cs:45) stay one free-text string on purpose: a display line that carries the venue name, with no invariant beyond its length (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Infrastructure/Persistence/EntityConfiguration/Events/EventConfiguration.cs:49-50), so the structuredAddresswould impose a shape the data does not have. ADC's Start/End pairs stay primitive too (Events/Event.cs:33-36,Activities/Activity.cs:33-36,Sessions/Session.cs:31-34): their only rule is order, enforced for Event and Activity byCommonInvariants.EnsureEndIsNotBeforeStart(Events/EventInvariants.cs:133,Activities/ActivityInvariants.cs:80) and for Session by its own strict-after rule,SessionInvariants.EnsureEndsAtIsAfterStartsAt(Sessions/SessionInvariants.cs:150, called atSessions/Session.cs:215and:283), and the framework ships no range value object to map them with. The same holds in Store, so the Start/End half of this exception is not ADC-only: Store'sVariantDiscountkeeps its activation window as two primitiveDateTimeOffset?properties (MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Shared/Products/VariantDiscount.cs:84,:87), ordered by a private rule of its own (EnsureWindowIsOrdered,:248-251).
Rationale
- The invariant belongs to the type, not to every caller. A
stringemail can be validated in one handler and not the next; anEmailcannot exist unvalidated, because the only entrance is a factory that returns a failure instead (Email.cs:30-41). That is the same invariant-over-discipline posture the framework takes elsewhere (ADR-015), applied one level below the aggregate. - Amount and currency are one value, so they are one type. Two loose columns can drift;
Moneymakes a currency mismatch aResultfailure at the point of arithmetic (Money.cs:131-139) rather than a silently wrong total. - Records give equality for free. Value semantics ("two addresses with the same fields are the same
address") is exactly what a positional-free
recordalready generates, so the base type can be empty and no per-type equality code has to be reviewed for a missed field. - The asymmetry with ADR-048 is the point. An identifier's only rule is uniqueness, and it crosses a serialization, schema or key boundary at nearly every hop, so wrapping it is pure friction. A domain value's rule is the reason the type exists, and it crosses those same boundaries rarely and through mappings worth writing once. Same mechanism, opposite verdict, because the cost/benefit genuinely inverts.
- A sentinel beats null for an absent currency.
Currency.NonekeepsMoney.Zero()usable as an accumulator seed and keeps every read path non-nullable; a null currency inside a materializedMoneyis aNullReferenceExceptionwaiting for the first read, which is precisely the failureOwnsMoney's fallback exists to prevent (EntityTypeBuilderExtensions.cs:38-45). - Ship the mapping, do not repeat it.
OwnsMoney,OwnsAddressand the two email converters put the round-trip contract in one reviewed place, so a new entity configuration is one call rather than a copied lambda pair that may or may not carry the sentinel fallback, or a copied six-property block whose lengths may or may not matchAddressInvariants. The helpers extendEntityTypeBuilderonly, so a value nested inside another owned type still needs the block by hand: Store'sVariantDiscount.SpecialPricerepeats theMoneymapping with its own sentinel fallback (.../Catalog.Infrastructure/Persistence/EntityConfiguration/ProductVariantConfiguration.cs:24,61-76, reason stated at:57-60).
Trade-offs
- The pattern is not uniformly applied. Only two of the four types (
Email,Address) have a companion*Invariantsclass;MoneyandCurrencyinline their checks. The two multi-field values each have a shipped owned-type helper (OwnsMoney,OwnsAddress), the single-stringEmailmaps through its converters, andCurrencyis persisted only insideMoney. All four carry a serialization attribute, and not the same one: three are[DataContract]/[DataMember](Money,Email,Address) whileCurrencycarries[JsonConverter(typeof(CurrencyJsonConverter))](Currency.cs:15). - Nothing gates that a domain value uses a value object. The
Create-returns-Resultrule is fitness-enforced, but no rule says a new email field must beEmailrather thanstring. MMCA.Helpdesk is the visible consequence: the reference app models everything on primitives. Store'sOrder.ContactEmail(Order.cs:87) and ADC'sTicket.OrderEmail(Ticket.cs:73) are smaller instances: each is validated throughEmail.Create(OrderInvariants.cs:180,TicketInvariants.cs:130) yet stored and carried as astring. - Read legs trust the column. The non-nullable converters materialize through
.Value!(EmailValueConverter.cs:41), which is sound for anything EF wrote and unsound for a value inserted by a manual script or data fix; the contract is documented rather than defended (EmailValueConverter.cs:24-31). - The currency set is closed in code.
Currency.AllisUSDandEUR(Currency.cs:56-60), so supporting a third currency is a framework change and a release, not configuration. Moneykeeps a throwing operator.operator +throwsInvalidOperationExceptionon a currency mismatch (Money.cs:108-114), which is the one place the value objects step outside the ADR-013 posture;Money.Addis theResult-returning path callers are steered to (Money.cs:131).- gRPC costs a hand-written mapping per value. There is no automatic proto projection, so every value object that has to cross a service boundary needs its own wire message and translation pair, the same class of friction ADR-048 declined to pay for identifiers.
Revision (2026-10-01)
No decision changed; four statements were corrected and anchors refreshed. (1) The Money sugar
paragraph claimed an external caller cannot assemble a Money whose currency was never checked.
Currency.Code (Currency.cs:34) and Money.Amount/Money.Currency (Money.cs:31,35) are public
init accessors in the shipped API (PublicAPI.Shipped.txt:550,556,558,732,738), so a with
expression bypasses FromCode and Create; the Decision now says so. (2) Store's Customer.Address
maps through OwnsAddress (CustomerConfiguration.cs:42) and then a second OwnsOne block
(:47-55) sets all six columns IsUnicode(), so the Status no longer says no consumer hand-writes an
Address block. (3) OwnsMoney extends EntityTypeBuilder only, so Store hand-maps the nested
VariantDiscount.SpecialPrice (ProductVariantConfiguration.cs:56-75); the Rationale records it. (4)
DateRange and DateTimeRange have no *Invariants class and no converter, so the Trade-offs no
longer say they ship with both, and "the two multi-field values" became two of four. Context and
Related now cite ADR-115 (wrapper structs opt-in, aliases default; DependencyInjection.cs:65). Not
yet recorded above and flagged here: a Money.Zero() serializes its currency as ""
(Currency.cs:92) and CurrencyJsonConverter.Read throws on it because FromCode rejects an empty
code (Currency.cs:43-44,83-85), so a None-currency Money does not JSON round-trip. Anchors
refreshed: CHANGELOG.md:1098, DependencyInjection.cs:54,67, CustomerConfiguration.cs:33,
EventValidationRules.cs:59,182, product_variants.proto:115,117,120 and adapter :190,221,199-204,121-125.
Revision (2026-10-06)
No decision changed. (1) The 2026-10-01 round-trip flag no longer holds: both currency converters
read the empty code back as the sentinel (Currency.cs:88-89, CurrencyJsonConverter.cs:26-27), and
Money's JSON read throws JsonException for a non-zero amount carrying it (Money.cs:70-76,
v1.232.0, CHANGELOG.md:30); the serialization bullet now says so, and the Decision notes that this
guard does not cover the with-expression path. (2) OwnsMoney pins the amount to decimal(18,2)
(EntityTypeBuilderExtensions.cs:78); the EF mapping bullet records it. (3) The ADC documented
exception paragraph sat under the Rationale heading while the Trade-offs pointed to "Adoption is real
but partial"; it now closes that Decision bullet. (4) The ADC social-login path is named
(CreateExternal, User.cs:264). Anchors were re-verified against current source across Common,
Store and ADC, including the Currency.cs, Money.cs, PublicAPI.Shipped.txt,
EntityTypeBuilderExtensions.cs, OwnsMoneyTests.cs:120 and CHANGELOG.md:1439 anchors.
Revision (2026-10-07)
Re-verified against current source. No decision changed and no behavior, default, count or adoption
site moved; only line anchors drifted. (1) Anchors re-verified against current source: the Money
JSON-read refusal bullet sits at MMCA.Common/CHANGELOG.md:55 (inside [1.232.0]), the
OwnsAddress bullet at MMCA.Common/CHANGELOG.md:1464 (inside [1.192.0]), the ADC
OrganizerContactEmail conversion at EventConfiguration.cs:64-66 and the ADC VenueAddress
length at EventConfiguration.cs:49-50.
Revision (2026-10-19)
No decision changed; the classification of every repo holds. Two statements in the documented
exception were narrower or broader than the code: (1) the primitive Start/End half is not ADC-only, since
Stores VariantDiscount keeps StartsOn/EndsOn as primitives
(MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Shared/Products/VariantDiscount.cs:84, :87),
so the exception and the Trade-offs candidate list now name it; (2) CommonInvariants.EnsureEndIsNotBeforeStart
guards Event and Activity only, while Session uses the strict-after
SessionInvariants.EnsureEndsAtIsAfterStartsAt
(MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Sessions/SessionInvariants.cs:149).
Revision (2026-10-21)
Re-verified against current source. No decision changed; the value-object set, the factory shape, the
OwnsMoney mapping and every adoption site hold. One mapping fact moved and anchors drifted.
(1) OwnsAddress no longer forces IsUnicode(false): its six columns take the provider's Unicode
default (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/EntityTypeBuilderExtensions.cs:114-118,
v1.247.0, MMCA.Common/CHANGELOG.md:70), and the EF mapping bullet now says so. OwnsMoney's code
column stays non-unicode (EntityTypeBuilderExtensions.cs:86). (2) Store's Customer.Address maps
through OwnsAddress alone
(MMCA.Store/Source/Modules/Identity/MMCA.Store.Identity.Infrastructure/Persistence/EntityConfiguration/CustomerConfiguration.cs:42);
the second OwnsOne block with its IsUnicode() override is gone, so the Decision no longer
describes it and the 2026-10-01 Status note about it no longer holds. (3) The ADR-015 reference is
worded as the fitness-function approach the rule follows
(MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Rules/Domain/ArchitectureRules.Entities.cs:53),
since ADR-015 records the mechanism in general rather than this rule. (4) Anchors re-verified against
current source: PublicAPI.Shipped.txt:575,581,583,771,777; EntityTypeBuilderExtensions.cs:133
(OwnsAddress), :135-136, :142-168, :170, :187-190; MMCA.Common/CHANGELOG.md:374 (inside
[1.232.0]) and :1783 (inside [1.192.0]); ADC User.cs:234,250 and CreateExternal at
:276, :284,295; Speaker.cs:41.
Revision (2026-10-26)
Re-verified against current source. No decision changed; the value-object set, the factory shape,
the Money sugar and with-expression paths, the Currency.None sentinel handling, the JSON-read
refusal, the shipped mapping helpers and every adoption site hold. Only line anchors drifted.
(1) Anchors re-verified against current source:
MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Financial/Money.cs [JsonConstructor] at
:55, OnDeserialized at :76-82, Create at :91 with the None rejection at :95-96,
operator + at :108-114, operator * at :120-121, Add at :131 with the mismatch failure
through :139, Multiply at :148, AddUnchecked at :155-162, Zero() at :166 and
Zero(Currency) at :171 (:21, :22, :31-36 unchanged);
MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:576,582,584,772,778;
MMCA.Common/CHANGELOG.md:1998 (inside [1.192.0]), :285 (inside [1.247.0]) and :589
(inside [1.232.0]); ADC
MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/User.cs:53, Email.Create at
:235 and :285, new User(...) at :251 and :296, CreateExternal at :277.
Revision (2026-10-28)
Re-verified against current source. No decision changed; the value-object set, the factory shape,
the Money sugar and with-expression paths, the Currency.None sentinel handling, the shipped
mapping helpers and every ADC adoption site hold. Store's adoption grew and one serialization guard
was missing from the record.
(1) Store's Order now carries four mapped Money values, not one: Total, Subtotal, ShippingCost and
TaxAmount
(MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Domain/Orders/Order.cs:111,114,117,120), all
seeded with Money.Zero() in the private constructor (:239-242), with CreateCore then setting
Subtotal to a copy of Total and ShippingCost and TaxAmount to currency-bearing zeros
(:362-364), and mapped through OwnsMoney with required: false
(.../Sales.Infrastructure/Persistence/EntityConfiguration/OrderConfiguration.cs:103,108-110);
Total is recomposed at checkout through Money.Add (Order.cs:505-517). The adoption bullet now
names all four.
(2) Order.ShippingAddress and Order.BillingAddress are a second Store Address site
(Order.cs:70,74), mapped through OwnsAddress with the Shipping and Billing prefixes
(OrderConfiguration.cs:38-39, migration 20261025021650_AddGuestOrdersAndShippingLabels). The
"only Address mapping" wording now applies to Customer alone.
(3) Store no longer matches ADC on primitive emails: the guest order's Order.ContactEmail is a
string? (Order.cs:59, plain column at OrderConfiguration.cs:28-30), validated through
Email.Create inside OrderInvariants.EnsureContactEmailIsValid
(.../Sales.Domain/Orders/OrderInvariants.cs:168-179, :173). The adoption bullet and the
"Nothing gates" trade-off now name it.
(4) Since v1.261.0 the Money [JsonConstructor] throws JsonException for a missing or null
currency (MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Financial/Money.cs:55-61,
MMCA.Common/CHANGELOG.md:60); the serialization bullet now records it beside the
IJsonOnDeserialized guard.
(5) Anchors re-verified against current source:
MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:586,592,594,785,791;
MMCA.Common/CHANGELOG.md:2041 (inside [1.192.0]), :328 (inside [1.247.0]) and :632
(inside [1.232.0]); Order.cs:236 (private constructor), :351,355;
.../Conference.Application/Speakers/DTOs/SpeakerDTOMapper.cs:65.
Revision (2026-11-23)
Re-verified against current source. No decision changed; the value-object set, the factory shape,
the Money sugar and with-expression paths, the Currency.None sentinel handling, the JSON-read
refusals, the shipped mapping helpers and the Store adoption sites hold. The JSON converter count, the
AddAPI registrations and the ADC adoption record moved.
(1) Currency has one JSON converter, not two: the API-layer CurrencyJsonConverter was removed as a
breaking change in v1.304.0 (MMCA.Common/CHANGELOG.md:245, inside [1.304.0]), and the converter attached to the type
(MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Financial/Currency.cs:15,75) serves MVC
and the non-MVC paths alike (:67-68) and reads the empty code as the sentinel (:88-89). The
serialization bullet now says so, and the earlier Status sentence for 2026-10-06 carries a
superseded marker on its two-converter phrase.
(2) AddAPI registers no JSON converter for these value objects: AddJsonOptions
(MMCA.Common/Source/Presentation/MMCA.Common.API/DependencyInjection.cs:55-67) adds only
EnumerationJsonConverterFactory (:60) and StronglyTypedIdJsonConverterFactory (:66), with the
XML formatters at :68 and the doc comment stating that Currency carries its own converter in
Shared (:31-32). The serialization bullet no longer says AddAPI registers the JSON converter.
(3) ADC's Domain does carry a primitive email: Engagement's Ticket.OrderEmail is a string?
(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:73) validated
through Email.Create (TicketInvariants.cs:130, Ticket.cs:372) and kept as a string, the same
shape as Store's Order.ContactEmail. The adoption bullet and the "Nothing gates" trade-off now name
it, the 2026-09-03 Status sentence carries a superseded marker, and the adoption bullet notes that a
Conference email-type question answer is validated through Email.Create and stored as submitted
(Questions/QuestionInvariants.cs:182-187), a generic answer value rather than an email property.
(4) ADC's User reaches Email.Create from four factories, not two: Create, CreateExternal,
CreateFromInvitation and CreateServiceAccount
(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/User.cs:218,269,318,356); the
adoption bullet now names all four.
(5) Anchors re-verified against current source:
MMCA.Common/Source/Core/MMCA.Common.Shared/PublicAPI.Shipped.txt:994,1000,1002,1356,1362 (three
init accessors and the Currency and Money clone methods); MMCA.Common/CHANGELOG.md:2978
(inside [1.192.0]), :1265 (inside [1.247.0]), :1569 (inside [1.232.0]) and :997 (inside
[1.261.0]); DependencyInjection.cs:66 (ADR-115 factory); Store
MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Domain/Orders/Order.cs:140,143,146,149, private
constructor :297 with seeds :300-303, CreateCore :369, Money.Add :412 assigned at :416,
re-seed :423-425, checkout recompose in ApplyCharges :524 (Money.Add at :544, :548,
Total at :556), ContactEmail :87, ShippingAddress/BillingAddress :99,103;
.../Sales.Domain/Orders/OrderInvariants.cs:175-186 with Email.Create at :180;
.../Identity.Infrastructure/Persistence/EntityConfiguration/UserConfiguration.cs:35-36; ADC
User.cs:56, Email.Create at :226, :277, :320, :359, new User(...) at :243, :289;
.../Conference.Domain/Events/EventInvariants.cs:39 (constant) and :133;
.../Conference.Domain/Sessions/SessionInvariants.cs:150, called at Session.cs:215 and :283.
Revision (2026-11-30)
Re-verified against current source. No decision changed; the factory shape and its fitness rule,
the Money sugar and with-expression paths, the Currency.None sentinel handling, the JSON-read
refusals, the shipped mapping helpers and every adoption site hold. The value-object set shrank.
(1) MMCA.Common v1.323.0 removed the three value objects that had no production consumer:
DateRange and DateTimeRange (the whole MMCA.Common.Shared.ValueObjects.Time namespace),
PhoneNumber and PhoneNumberInvariants, the PhoneNumberValueConverter and
NullablePhoneNumberValueConverter EF converters, and the error translations only they emitted
(MMCA.Common/CHANGELOG.md:17, inside [1.323.0]).
MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/ now holds Address, Currency, Email
and Money (with AddressInvariants, EmailInvariants and UsPostalRegions) beside the
ValueObject and Enumeration bases, and EmailValueConverter.cs is the only value-object
converter file under MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conversions/.
(2) Corrected in place: the type count and list (four, not seven); the factory and *Invariants
bullets; the converter list in the EF mapping bullet; the [DataContract] list and the closing
sentence about annotation-free range types in the serialization bullet; the adoption bullet's
closing sentence (every shipped value object now has a consumer); the documented exception's
converter remark; the Rationale's converter count (the two email converters); the "not uniformly
applied" trade-off; and the "Three of the seven have no consumer" trade-off, removed because no
type is left without one. The earlier dated Revision sections keep their wording as historical
records.
(3) Anchors re-verified against current source:
MMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Contact/Address.cs:15, :16, :19-40,
:42, :69, :77; Contact/Email.cs:15, :16, :19, :22, :30; Financial/Currency.cs:15,
:16, :43; Financial/Money.cs:21, :22, :31, :35, :55, :91;
Contact/EmailInvariants.cs:23; Contact/AddressInvariants.cs:50.
Revision (2026-11-30, v1.324.0)
MMCA.Common v1.324.0 (MMCA.Common/CHANGELOG.md:21, :34). The four value objects, their factories and
their mappings are unchanged. What changed is the request-side validation that guards the wire string
before it reaches a factory: it now runs the value object's own invariant instead of a look-alike.
- Email validation delegates to the value object's invariant.
EmailRules<T>checks the format throughEmailInvariants.EnsureEmailIsValid, the checkEmail.Createruns, trimming first exactly as the factory does (MMCA.Common/Source/Core/MMCA.Common.Application/Validation/CommonValidationRules.cs:112,BeAWellFormedEmailat:131-134; the invariant atMMCA.Common/Source/Core/MMCA.Common.Shared/ValueObjects/Contact/EmailInvariants.cs:23, its format check at:43). The UI'sOptionalEmailAttributeruns the same check (MMCA.Common/Source/Presentation/MMCA.Common.UI/Validation/OptionalEmailAttribute.cs:26,:66). Before this releaseEmailRules<T>used FluentValidation'sEmailAddress()and the attribute mirrored its one-@check, so a request validator could accept an address the factory then refused; now they are one rule, and the rule is stricter than FluentValidation'sEmailAddress()(a@bis rejected). With no code supplied, a malformed address fails under the factory's own code,Email.InvalidFormat, read from the invariant at type initialization so the two cannot drift (CommonValidationRules.cs:118-119,:126;EmailInvariants.cs:46). This follows the precedentAbsoluteUrlRules<T>already set withCommonInvariants.EnsureUrlIsWellFormed(CommonValidationRules.cs:147,:162). - Rule sets answer under per-rule codes.
RequiredStringRules<T>,EmailRules<T>,AbsoluteUrlRules<T>,StrongPasswordRules<T>and the US address rule sets take an optional trailingcodePrefix, under which each rule answers as{codePrefix}.Required,.MinLength,.MaxLength,.Invalidand so on (CommonValidationRules.cs:36-37; constructors at:79,:121,:153,:250); passing botherrorCodeandcodePrefixthrows (:46-52). The weakerPasswordRules<T>andUsAddressValidatorare removed. - FluentValidation's default codes never reach the wire.
ToErrorsreplaces a code that ends inValidator(the validator class name a rule with no code of its own carries) with{PropertyPath}.{Rule}, for exampleEmail.RequiredorName.MaxLength, and passes an explicit code through unchanged (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/ValidationFailureExtensions.cs:19-34,:51-53,:60-66).ValidationErrorCodeTestsBase(MMCA.Common.Testing.Architecture) fails a literal code ending inValidatorand any read ofValidationFailure.ErrorCodeoutsideToErrors(MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Bases/Governance/Contracts/ValidationErrorCodeTestsBase.cs:16; rule at.../Rules/Contracts/ArchitectureRules.ValidationCodes.cs:32). Items 2 and 3 are recorded here because item 1's code depends on them; the error taxonomy itself is ADR-013's.
Related
ADR-048 (the deliberate opposite call for identifiers: primitives behind aliases, wrapper structs
rejected, because identifiers cross process boundaries constantly and carry no invariant), ADR-115
(the wrapper struct shipped as an opt-in capability, with aliases still the default), ADR-013
(the Result pattern these factories implement below the aggregate level), ADR-015 (the
architecture fitness-function approach that DomainFactoriesReturnResult follows to enforce the
Create-returns-Result shape on value objects too).