efcore icon indicating copy to clipboard operation
efcore copied to clipboard

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

Open AndriySvyryd opened this issue 3 years ago • 6 comments

Split off from #19811

modelBuilder.Entity<Customer>().ToTable("Customer");
modelBuilder.Entity<SpecialCustomer>().ToTable("SpecialCustomer", tb =>
{
    tb.Property(c => c.Id)
        .HasDefaultValue("1")
        .HasDefaultConstrainName("blah")
        .HasDefaultValueSql("newid()")
        .HasComputedColumnSql("1")
        .HasConversion<string>()
        .HasColumnType("nvarchar(100)")
        .IsRequired(false)
        .HasMaxLength(100)
        .IsUnicode(false)
        .HasPrecision(1, 2)
        .HasCollation("Latin1_General_BIN2");
});

AndriySvyryd avatar May 07 '22 02:05 AndriySvyryd

@AndriySvyryd @ajcvickers I'm interested in #24685. Is this planned for EF Core 8 release by any chance?

maximcus avatar Jul 24 '23 06:07 maximcus

@maximcus No. Vote (👍) for both issues so we consider them for future releases

AndriySvyryd avatar Jul 25 '23 20:07 AndriySvyryd

This is also a problem for explicit constraint names (e.g. key constraint, default constraint)

maumar avatar May 07 '25 23:05 maumar

This issue is making itself quite apparent when you want to set a database computed column on a TPC entity, but not others of the same inherited type.

kescherCode avatar May 15 '25 06:05 kescherCode

Still using EF 6 because of this lack.

Ukkie007 avatar Jun 16 '25 09:06 Ukkie007

@Ukkie007 EF 6 is out of support. Also, AFAIK this isn't something that was supported in EF 6, so I'm not sure how keeping on that version helps.

roji avatar Jun 16 '25 10:06 roji

I need Split mappings in a TPH scenario. As this case "Spilt mappings are not supported for hierarchies #34190" is closed being a duplicate, I repeat my question here. I am aware that EF6 is not supported anymore, but I don't see any alternative. More > 200 databases in production.

Ukkie007 avatar Jun 18 '25 10:06 Ukkie007

Ah sorry, you meant non-core EF6 before, rather than EF Core 6, my bad. FWIW non-core EF6 is technically not out of support, but is no longer being evolved (so would receive critical security fixes). Added ef6-parity label.

roji avatar Jun 18 '25 16:06 roji