Relational: Entity splitting support
This work item represents the mapping capability to slice the data contained by an object into multiple tables.
Limitations:
- Properties mapped to multiple columns can't use store-generated values
- Foreign keys and indexes split across tables won't be created in the database
Related: https://github.com/dotnet/efcore/issues/17270#issuecomment-588037768
I would love if this feature does not fill in the standard Relational library but perhaps is exposed as a additional feature (pay for play scenario) which I can plug in only if needed
Related to TPT https://github.com/aspnet/EntityFrameworkCore/issues/2266
Note: consider optional relationships: #9773
- [x] Model building
- [x] Column name overrides
- [x] Runtime model
- [x] Compiled model
- [x] Relational model
- [x] Migrations
- [x] Snapshot
- [x] Seeding
- [x] Update
- [ ] Query
- [ ] Tests
- [ ] Non-PK columns duplicated across tables
- [ ] Concurrency tokens
- [ ] Customizing linking FK (By default it's required dependent)
- [ ] Views
- [ ] With triggers and owned types
- [ ] With table splitting
API proposal:
modelBuilder.Entity<Customer>().SplitToTable("CustomerDetails", tb =>
{
// PK mapped to all tables by default
// Any other property mapped to a split table is not mapped to the default table
tb.Property(c => c.AlternateKey);
// Empty column name effectively removes the property from the mapping fragment
tb.Property(c => c.AlternateKey).HasColumnName("");
});
modelBuilder.Entity<Customer>().ToTable("Customer", tb =>
{
// Properties can be explicitly mapped to the default table too
tb.Property(c => c.AlternateKey);
});
modelBuilder.Entity<Customer>().SplitToView("CustomerView", tb =>
{
tb.Property(c => c.AlternateKey);
});
Would be very appreciated for implementing this, we have a lot of legacy one-to-one tables in DB which make no sense to treat separately in backend
Would very much love this feature, also the optional relationships is a must have when implementing entity splitting
Any update? Would love to see this feature incorporated.
@maurei This issue is in the Backlog milestone. This means that it is not going to happen for the 3.0 release. We will re-assess the backlog following the 3.0 release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.
I suppose what Owned Entity Types can be used as an alternative for Entity Splitting and it's already implemented at EFCore 2.0.
Hi. Do you have any update?
@ArtemTereshkovich This issue is in the Backlog milestone. This means that it is not going to happen for the 3.0 release. We will re-assess the backlog following the 3.0 release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.
This feature is a must for people migrating legacy systems to EF.
Yes please - consider the scenario where a table is split for patitionin causes (for example, to separate LOB and row data).
Lacking this feature in EF Core stops me (like other people) from migrating legacy projects from EF 6.4. @ajcvickers Do you have any concrete plan/schedule? What does "considered-for-net-release" label mean? .NET 5 (scheduled in November 2020) or .NET Core 3.x (may happend earlier)?
@bairog We'll consider adding it to EF Core 5 if there's enough time left, otherwise it will likely go into EF Core 7
Hello. Do you have any updates? Is it going to be included to EF Core 5 release?
@bairog no, this feature did not make it into the upcoming 5 release. We'll consider this again for the 6.0 planning
Hello. Are you planning to implement this in EF Core 6.0? It is vital for EF6 feature parity. No single word about it in this devblogs announcement
@bairog This is a stretch goal for EF Core 6.0, as indicated by consider-for-current-release label. This means we may get to it for 6.0 if we have time in the schedule, but you shouldn't count on it.
So it looks like even EFCore 6.0 LTS most likely will not have the entire list of current EF 6.4 features. Very disappointing to hear :(