❔ fluent api naming/design

Hi all, working on designing a fluent api inspired by EF Core, in this case the IEntityTypeBuilder

I am trying to determine language to describe these situations:

Exactly one of (set of properties) required
One or more (set of properties) required
If property 1 is present, property 2 must be present
If any of (set of properties), (set of properties) is required

Here's some I've thought of:

builder.OneOf(x => x.Foo, x => x.Bar)
builder.AnyOf(x => x.Foo, x => x.Bar)
Builder.Required(x => x.Property2).When(x => x.Property1, isPresent: true)

I should note, if a property is always mandatory, it is a naked property in the model (public string Name { get;})
If it is optional or conditionally optional, it exists as an Optional<T>, which helps account for cases where logically null and logically missing are two different scenarios.
Was this page helpful?