Entity Framework Tutorial
Lesson 62 of 69 · Part 21 Table Per Type TPT inheritance code first · Database
Part 21 Table Per Type TPT inheritance code first
Text version of the video
http://csharp-video-tutorials.blogspot.com/2014/06/part-21-table-per-type-tpt-inheritance.html
Slides
http://csharp-video-tutorials.blogspot.com/2014/06/part-21-table-per-type-tpt-inheritance_8.html
Entity Framework – All Text Articles
http://csharp-video-tutorials.blogspot.com/2014/05/entity-framework-tutorial.html
Entity Framework – All Slides
http://csharp-video-tutorials.blogspot.com/2014/05/entity-framework-tutorial-slides.html
Entity Framework Playlist
Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd
In this video, we will discuss implementing Table Per Type (TPT) inheritance in entity framework with code first approach. This is continuation to Part 20, where we discussed implementing Table Per Type inheritance with database first approach. Please watch Part 20 before proceeding.
In TPT inheritance one database table per type is used to store data for the respective entity types in the inheritance hierarchy.
By default Entity Framework creates ONE TABLE for all the entity types in the inheritance hierarchy
To have a table created for each entity type in the inheritance hierarchy use Table attribute
Fluent API can also be used to do the table mapping by overriding OnModelCreating() method