Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework Core table Splitting approach

In Entity Framework 6, you can split the entity to be saved in multiple tables with the feature MAP:

modelBuilder.Entity<Employee>()  
  .Map(map =>  
  {  
  map.Properties(p => new  
  {  
     p.EmployeeId,  
     p.Name,  
     p.Code  
  });  
  map.ToTable("Employee");  
  })  
  // Map to the Users table  
  .Map(map =>  
  {  
  map.Properties(p => new  
  {  
     p.PhoneNumber,  
     p.EmailAddress  
  });  
  map.ToTable("EmployeeDetails");  
  });  

I was wondering if somebody knows if this is possible to do on entity framework core, I've searching about it a long time and didnt find anything similar.

At the moment, I'm using Dtos with composition to solve this problem, but is getting annoying to work with as the solution is growing.

Any help would be appreciated, Thanks.

like image 928
Bruno Joaquim Avatar asked Aug 31 '25 06:08

Bruno Joaquim


1 Answers

Not implemented yet, as can be seen in this open ticket: https://github.com/aspnet/EntityFramework/issues/619

like image 78
Ricardo Peres Avatar answered Sep 02 '25 20:09

Ricardo Peres