required modifier

The C# required keyword on a property, which makes the compiler refuse any construction that does not set it.

In more detail

public required string Name { get; set; } means no Product can exist without a name. It guards construction in C# only; database nullability still comes from the EF Core model.

Related terms

Taught in

References