There are a number of mapping scenarios in the Entity Framework to relate the data store to the conceptual model. If we have two tables with a key in common, one-to-one or zero-to-one relationship, we can merge them into one entity. This is called entity splitting.
In the example below (see the design here) we have extended the Album entity with an optional AlbumSpec. In the database we have two identical tables to store these entities.
Since Album and AlbumSpec have a key in common and there’s a zero-to-one relationship, we can merge the AlbumSpec properties into the Album entity. This is a simple select, cut and paste of the properties from AlbumSpec to Album as shown here. We transfered DistributionPartner, CoverType and Label to the Album entity.
We need to map these properties to the data store by hand using the Table Mapping of the Album entity. We add an extra table mapping for the AlbumSpec table as shown below.
Finally we don’t need the AlbumSpec in the model any more, so we can safely throw it in the trashbin. If we hit the delete key the ‘Delete Unmapped Tables and Views’ dialog appears. The message states that ‘The following tables and Views in the store model will no longer be mapped. Do you want them deleted?’. Be sure to choose ‘No’, since we still need that mapping to the properties we just moved to the Album entity.
So now we have merged two tabled via mapping into one entity.