Skip to content

Explain when NRT *may* change runtime behavior #19633

Closed
@Youssef1313

Description

@Youssef1313

In Entity Framework, enabling nullable reference types feature without code modifications will change the behavior.

Without NRT: any reference type property maps to be optional in the database, unless the RequiredAttribute is explicitly added.

With NRT: any reference type property maps to be required in the database, unless it's marked with nullable annotation.

The article gives an impression that enabling NRT will never change the runtime behavior.

I'm not sure how entity framework knows under the hoods if the property is marked with nullable annotation or not, (maybe reflection?). But anyways, the explanation about this point shouldn't be EF-specific, but to whatever technique that is used to determine the nullability at runtime, and EF may be just taken as an example.

Although this is not the common case, and is actually rare, but I think worth noting.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 447122

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.dotnet-csharp/svcin-prThis issue will be closed (fixed) by an active pull request.null-safety/subsvcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions