C#C
C#4y ago
Anton

❔ EF Core nullability vs API nullability behavior

In EF Core, nullability of properties is deduced from the nullability of their type. In API's however, even if the type of property is not nullable, it's deduced to be optional unless I apply [Required].
Also, EF Core ignores public getters without setters, while API's serialize them.
I'm judging by the generated swagger schema.
Is there a way to configure them to behave the same way, at least for nullability?
Was this page helpful?