A domain scalar without the boilerplate
You want a strong EmailAddress type with normalisation and validation, without hand-writing factories, equality, conversions, and a JSON converter.
[Scalar]
public readonly partial record struct EmailAddress
{
public string Value { get; }
static partial void OnNormalize(ref string value)
=> value = value?.Trim().ToLowerInvariant()!;
} What you get: The generator adds Create, Hydrate, TryCreate, and Empty, plus equality, comparison, implicit conversions, and a JSON converter.
One declaration replaces the factory, equality, comparison, conversion, and serialization code you would otherwise maintain by hand.
Read the guide →