Skip to content
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

Allow TPT when primary key columns in the tables do not exactly match #23345

Closed
overdunne opened this issue Nov 16, 2020 · 1 comment
Closed

Comments

@overdunne
Copy link

Trying to apply TPT inheritance in EF Core 5, using an existing schema. How can I specify the primary and foreign key column name in the child table, if the column name does not exactly match the parent table? In the documentation example, we would not have Pets.Id, but Pets.PetId:

CREATE TABLE [Animals] (
[Id] int NOT NULL IDENTITY,
[Species] nvarchar(max) NULL,
CONSTRAINT [PK_Animals] PRIMARY KEY ([Id])
);

CREATE TABLE [Pets] (
[PetId] int NOT NULL,
[Name] nvarchar(max) NULL,
CONSTRAINT [PK_Pets] PRIMARY KEY ([PetId]),
CONSTRAINT [FK_Pets_Animals_Id] FOREIGN KEY ([PetId]) REFERENCES [Animals] ([Id]) ON DELETE NO ACTION
);

@ajcvickers
Copy link
Member

@overdunne This is tracked by #19811

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants