Hi there,
Is it possible to have "table per type" inheritance in the Entity Framework 4 if the derived table has a composite primary key?
Here is my table setup:
TABLE: ConfigurationKey (Base Entity)
PK: Id
TABLE: ConfigurationKey_Device (Derived Entity)
PK: ConfigurationKeyId (FK to ConfigurationKey.Id)
PK: DeviceId (FK to Device.Id)
For what it's worth, ConfigurationKey is going to be abstract and other types are going to derive from ConfigurationKey.
Using the EF designer, I have:
- Added the inheritance rule
- Deleted ConfigurationKeyId from ConfigurationKey_Device
- Deleted the FK linking ConfigurationKey_Device to ConfigurationKey
- Updated the mapping of the ConfigurationKey_Device.ConfigurationKeyId column to the inherited Id property.
The error I am now getting is:
Error 3003: Problem in mapping fragments starting at line xxx:All the key properties (ConfigurationKeys.Id) of the EntitySet ConfigurationKeys must be mapped to all the key properties (ConfigurationKey_Device.ConfigurationKeyId, ConfigurationKey_Device.DeviceId) of table ConfigurationKey_Device.
Thanks, Chris