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.
Not implemented yet, as can be seen in this open ticket: https://github.com/aspnet/EntityFramework/issues/619
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With