EntityFrameworkCore.TemporalTables
EntityFrameworkCore.TemporalTables copied to clipboard
Multiple of the same Owned type causes exception with Update-Database
I want to use multiple of the same type as owned type. Something like:
class Compay {
public Contact Contact1 { get; set; }
public Contact Contact2 { get; set; }
}
Contact is configured to be owned type, with .OwnsOne(...).
When I call modelBuilder.UseTemporalTables() (without this call, it all works)
then during Update-Database I get this exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.RelationalEntityTypeExtensions.GetTableName(IEntityType entityType)
at EntityFrameworkCore.TemporalTables.Sql.TemporalTableSqlBuilder1.BuildTemporalTableSqlFromEntityTypeConfiguration(IEntityType entityType, Boolean appendSeparator) at EntityFrameworkCore.TemporalTables.Sql.TemporalTableSqlBuilder
1.BuildTemporalTablesSqlForEntityTypes(IEnumerable1 entityTypes, Boolean appendSeparator) at EntityFrameworkCore.TemporalTables.Sql.TemporalTableSqlBuilder
1.BuildTemporalTablesSql(Boolean appendSeparator)
at EntityFrameworkCore.TemporalTables.Sql.TemporalTableSqlExecutor1.Execute() at EntityFrameworkCore.TemporalTables.Migrations.TemporalTableMigrator
1.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Object reference not set to an instance of an object.
Hi @findulov , please have a look!