You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
);
The text was updated successfully, but these errors were encountered:
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
);
The text was updated successfully, but these errors were encountered: