Closed marcwittke closed 1 year ago
@marcwittke We believe this is already fixed in EF Core 5.0. Can you try with the RC1 release and see if you still run into this?
@ajcvickers yes, rc1 fixes the issue, thanks for the feedback.
Also learned that I can target netcore 3.1 with EF Core 5.0 which is nice.
Assuming the following domain model with a base
Order
class, that has two different inheritors:InternalOrder
owning aOrderStoreInfo
andExternalOrder
owning aOrderSupplierInfo
:gets mapped like this:
Creating the migration with
dotnet ef migrations add Initial --verbose
fails withEntity type 'OrderStoreInfo' doesn't contain a property mapped to the store-generated concurrency token column 'Timestamp' that is used by another entity type sharing the table 'purchasing.Orders'. Add a store-generated property mapped to the same column to 'OrderStoreInfo'. It can be in shadow state.
:Somewhere I read in a comment that you have to appy the timestamp mapping to all different types of the hierarchy or even on the owned types as well. So let's try... Both inheritors getting the Timestamp shadow property:
running
dotnet add migrations add Initial
results in the exact same error:Entity type 'OrderStoreInfo' doesn't contain a property mapped to the store-generated concurrency token column 'Timestamp' that is used by another entity type sharing the table 'purchasing.Orders'. Add a store-generated property mapped to the same column to 'OrderStoreInfo'. It can be in shadow state.
so let's add the timstamp shadow property to the owned types as well:
running
dotnet add migrations add Initial
now results in a slightly different error:Entity type 'ExternalOrder' doesn't contain a property mapped to the store-generated concurrency token column 'Store_Timestamp' that is used by another entity type sharing the table 'purchasing.Orders'. Add a store-generated property mapped to the same column to 'ExternalOrder'. It can be in shadow state.
but still no luck. Is this scenario supported? Did I find a bug?
Further technical details
EF Core version: 3.1.8 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET Core 3.1 Operating system: GNU/Linux (Fedora 32) IDE: Rider 2020.2
Repro-repo: https://github.com/marcwittke/EfCoreInheritanceOwned