✅ Required property
Hello there.
I am creating a class with some required properties. I have decorated them with the [Required] thing, however, it's still complaining. Are you supposed to have both [Required] and the required keyword? Example:
Should it be this instead?:
2 Replies
[Required]
is an attribute that, say, EF Core can use to create a column that is not nullable
required
keyword is enforced by the compiler. And also provides that information to EF
Actually, with nullable reference types being enabled, the type being a string
and not string?
already gives EF that info
So required
is mostly just for compiler enforcementUnknown User•7mo ago
Message Not Public
Sign In & Join Server To View