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

foreign key in TPH #2887

Closed
endink opened this issue Aug 20, 2015 · 0 comments
Closed

foreign key in TPH #2887

endink opened this issue Aug 20, 2015 · 0 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@endink
Copy link

endink commented Aug 20, 2015

Hi,
When the top level entity in the hierarchy will repeat to generate the foreign key T-SQL。
example:

public class B : A { }
public class C : A { }

public abstract A class
{
    int ForeignId { get; set; }
}

public D class
{
    public ICollection<A> AList { get; set; }
}

the mapping code for 'D':

builder.Collection(p => p.AList).InverseReference().ForeignKey(e => e.ForeignId);

the T-sql will like this:

CREATE TABLE [A] (
        ....
        CONSTRAINT [FK_A_D_ForeignId] FOREIGN KEY ([ForeignId]) REFERENCES [D] ([Id]),
        CONSTRAINT [FK_A_D_ForeignId] FOREIGN KEY ([ForeignId]) REFERENCES [D] ([Id]),
        CONSTRAINT [FK_A_D_ForeignId] FOREIGN KEY ([ForeignId]) REFERENCES [D] ([Id])
@endink endink changed the title foreign key in PTH foreign key in TPH Aug 20, 2015
@rowanmiller rowanmiller added this to the 7.0.0 milestone Aug 21, 2015
@bricelam bricelam modified the milestones: 7.0.0-beta8, 7.0.0 Aug 24, 2015
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-beta8, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants