FransBouma/LinqToSQL2

Add support for entity splitting (multiple entity types, same table row)

FransBouma opened this issue · 0 comments

Entity splitting is sometimes a nice feature if you want to model a part of an entity into another entity. Typical example is to model the Photo field (which is an Image field) in an Employee entity into a separate entity, e.g. EmployeePhoto, with a 1:1 relationship over the PK. This allows the Employee entity to not fetch the Photo field by default, only when the related entity is fetched as well.

The implementation is a little tricky because persisting a new EmployeePhoto entity isn't an insert but an update of an existing row. I.o.w.: the entity type has to be known as a 'split off' entity so the core logic knows to generate an update, not an insert.

(related to #21)