© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
16 replies
barcode

What does null! do in EF CORE? [Answered]

Hi, I've used scaffold db to generate models from existing table and I noticed this interesting pattern

    public City City { get; set; } = null!;
    public City City { get; set; } = null!;


Keep in mind city_id must not be null so why does EF Core generate it with default value of null and what does ! mean after unll?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

EF-Core data reference [Answered]
C#CC# / help
4y ago
Can't install EF core tools [Answered]
C#CC# / help
4y ago
EF Core
C#CC# / help
2y ago