Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Under the following model: [url=http://www.freeimagehosting.net/][img]http://www.freeimagehosting.net/uploads/258829be4d.jpg[/img][/url]

BaseClass
id <PK>
testProperty
SubClass: BaseClass
idSubClass <PK removed after inheriting from baseclass>
Nav Property
SubClassRelated

SubClassRelated
idSubCLassRelated <PK>
Athing
Nav Property
SubClass

I receive the following error when validating:
"Error 3024: Problem in Mapping Fragment starting at line 129: Must specify mapping for all key properties (id) of End SubClass in Relationship FK_SubClassRelated_SubClass."
The association cannot be done because I have lost the PK in SubClass after creating the inheritance relation with BaseClass... is that possible to have associations in subclasses when the PK is on the subclass?
Including the schema here just in case it helps:
CREATE TABLE [dbo].[BaseClass](
[id] [int] IDENTITY(0,1) NOT NULL,
[testProperty] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_BaseClass] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[SubClass](
[idSubClass] [int] IDENTITY(0,1) NOT NULL,
[id] [int] NOT NULL,
CONSTRAINT [PK_SubClass] PRIMARY KEY CLUSTERED
(
[idSubClass] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[SubClassRelated](
[idSubClassRelated] [int] IDENTITY(0,1) NOT NULL,
[AThing] [nvarchar](20) NOT NULL,
[idSubClass] [int] NULL,
CONSTRAINT [PK_SubClassRelated] PRIMARY KEY CLUSTERED
(
[idSubClassRelated] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900