Nullable property is required if there is another not-nullable string property in model #16760
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
Hello. After i upgraded to preview7 from preview5 some of my queries started to throw exceptions cause of null values in database for nullable properties. I reproduced this in test project and there is something strange. I have
Nullable reference types
enabled.Steps to reproduce
Define model class
Now generate migration:
Property
EmptyId
hasnullable: true
as it should.Now let's create another model with additional sting property
and generate new migration
Here property
EmptyId
hasnullable: false
for some reasons.If we change
SomeString
to nullable stringthen both properties are correctly nullable:
and if we move
EmptyId
to base class:it will be nullable:
Further technical details
EF Core version: 3.0.0-preview7.19362.6
Database Provider: Microsoft.EntityFrameworkCore.SqlServer and Npgsql.EntityFrameworkCore.PostgreSQL
Operating system: Windows 10 18941
IDE: dotnet cli
The text was updated successfully, but these errors were encountered: