namespace New.Domain.ValueObjects; /// /// The applicant's name. Deliberately called PersonName/Applicant /// rather than the case-framework's "Participant" - see the false-cognates /// table in the migration design notes. /// public sealed record PersonName { public string Surname { get; } public string Initials { get; } public PersonName(string surname, string initials) { if (string.IsNullOrWhiteSpace(surname)) { throw new DomainInvariantViolationException( "PersonName.SurnameRequired", "A surname is required."); } if (string.IsNullOrWhiteSpace(initials)) { throw new DomainInvariantViolationException( "PersonName.InitialsRequired", "Initials are required."); } Surname = surname; Initials = initials; } }