Minimal reproducible example
How to seed entities with .OwnsOne
and .HasData
when having nullable objects
Scripts+
dotnet ef migrations add Initial --context NullableObjectDbContext -o Migrations/NullableObject
dotnet ef migrations remove --context NullableObjectDbContext
Scripts+
dotnet ef migrations add Initial --context TwoLevelDbContext -o Migrations/TwoLevel
dotnet ef migrations remove --context TwoLevelDbContext
Scripts+
dotnet ef migrations add Initial --context ThreeLevelDbContext -o Migrations/ThreeLevel
dotnet ef migrations remove --context TwoLevelDbContext
Scripts+
dotnet ef migrations add Initial --context SimpleNullableDbContext -o Migrations/SimpleNullable
dotnet ef migrations remove --context SimpleNullableDbContext
Scripts+
dotnet ef migrations add Initial --context NullableObjectNestedNonNullableDbContext -o Migrations/NullableObjectNestedNonNullable
dotnet ef migrations remove --context NullableObjectNestedNonNullableDbContext