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 specifying different foreign key facets per table in TPT, TPC or entity splitting #27971

Open
Tracked by #22953
AndriySvyryd opened this issue May 7, 2022 · 0 comments

Comments

@AndriySvyryd
Copy link
Member

AndriySvyryd commented May 7, 2022

Split off from #19811

modelBuilder.Entity<Customer>().ToTable("Customer");
modelBuilder.Entity<SpecialCustomer>().ToTable("SpecialCustomer", tb =>
{
    tb.HasForeignKey<Customer>(c => c.Id)
      .IsRequired(false)
      .HasConstraintName("FK_CustomerDetails_Customer");
});

Alternative API:

modelBuilder.Entity<Customer>().HasOne<Customer>().WithOne()
    .HasForeignKey<Customer>(c => c.Id)
    .IsRequired(false)
    .ToTables("CustomerDetails", "Customer", tb => tb.HasConstraintName("FK_CustomerDetails_Customer"));
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

1 participant