Closed Smoovsky closed 6 days ago
This will be fixed in 9.0, but we don't think this affects enough users to meet our patch bar.
As a workaround you can ignore the target entity type first:
modelBuilder.Ignore<EntityType2>();
modelBuilder.Entity<EntityType1>().Ignore(x => x.E2);
If it still should be refenced from other entity types you can configure those navigations explicitly afterwards.
Today I ran into a weird
InvalidOperationException
with message"The object has been removed from the model."
. And it took me hours to narrow down what triggers the exception. It turns out that when objects are nested in a specific pattern and with some uncertain property naming, the exception emerges. And the exception is specific to CosmosDb provider. It could be reproduced as (.NET Fiddle is also available):EF Core version: 8.0.7 Database provider: Microsoft.EntityFrameworkCore.Cosmos Target framework: NET 8.0 Operating system: Windows 11 Pro 23H2 Build 22631.3958