-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TPH Mapping: ApplyConfiguration specific order required? #18385
Comments
Thanks for finding out it was the order, we also had this problem and I hadn't tried changing the orders of the mappings, although in another case it worked so it kind of makes sense that it was this. |
Is this fixed for EF Core 3.1.x? This used to work in EF Core 2.2. |
@bdaniel7 This was fixed in 3.1.0, as indicated by the milestone. |
Ok, I removed the IEntityTypeConfiguration<> for the derived types and then it worked. |
I'm trying to migrate from efcore 2.2 to 3.0 and ran into a issue with our Entities that have inheritance defined. It seems that now the order in which our mappings are configured is important, and since it worked before, it feels like a bug.
I simplified our structure as much as possible to reproduce the issue.
Steps to reproduce
Entity classes:
Mappings:
DBContext (this one fails when trying to query DataEntries)
Exception:
When i switch the order, so that my base mapping with the discriminator definition is last, it works.
For me it seems that the
SubBaseDataMap
mapping is somehow overriding the discriminator/inheritance defined in theBaseDataMap
.Here is my demo wich demonstrates this with the InMemory Provider, i also tested it on an local sqlserver instance.
Program.zip
Further technical details
EF Core version: 3.0.0 (current NuGet)
Database provider: Microsoft.EntityFrameworkCore.InMemory, Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3.5
The text was updated successfully, but these errors were encountered: