dotnet / dotnet/efcore

Allow specifying different foreign key facets per table in TPT, TPC or entity splitting

Open
#27,971 0 comments 7 reactions 0 assignees View on GitHub
area-model-building area-relational-mapping
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Split off from #19811
``` C#
modelBuilder.Entity().ToTable("Customer");
modelBuilder.Entity().ToTable("SpecialCustomer", tb =>
{
tb.HasForeignKey(c => c.Id)
.IsRequired(false)
.HasConstraintName("FK_CustomerDetails_Customer");
});
```

Alternative API:
``` C#
modelBuilder.Entity().HasOne().WithOne()
.HasForeignKey(c => c.Id)
.IsRequired(false)
.ToTables("CustomerDetails", "Customer", tb => tb.HasConstraintName("FK_CustomerDetails_Customer"));
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.