© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
3 replies
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]
[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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Ef core-Odd Behavior
C#CC# / help
3y ago
EF Core
C#CC# / help
2y ago
Extending EF Core codegen - API Limitation?
C#CC# / help
3mo ago
✅ ASP.NET API (EF Core) Relationships
C#CC# / help
4y ago