Part 21 Table Per Type TPT inheritance code first

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

Entity Framework - All Text Articles

Entity Framework - All Slides

Entity Framework Playlist

Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses

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
Рекомендации по теме
Комментарии
Автор

Thanks a lot Venkat! Your videos are truly awesome.

maurobilotti
Автор

Good tutorials on EF. However throughout this tutorials of EF, I had one question. How the application comes to know that it needs to create db tables when we use Code First Approach. How it connects and create db tables? Can anyone clear my doubts plz.

computer_programming_gk
Автор

Thank you kudvenkat for tutorials.
I have a question.
When inserting new data, i think we don't want to insert duplicate data in "PermanentEmployees" or in "ContractEmployees" tables.
how can we handle this?
Option 1: Make "AnnualSalary", "HoursWorked", "HourlyPay" columns unique.
Option 2: Use trigger to check data before inserting (this is bad in my opinion)
Any suggestions?
And again thank you for this lessons, i learned a lot from those you are truly helping me, god bless you.

tene
Автор

Can't use "timestamp" /rowversion, TPT generates an error: "not allowed for subtypes of base entity". Besides creating a stored procedure in the database are there some other solution in entity framework?

amnesia
Автор

In this part after creating Employees table why "Discriminator" column not created? which created in Part 19. I am confused here. Please answer me.

shailendraphadke
Автор

Is in dbcontext class same as [table("")] ?

jumbo
Автор

how your employee object which is of Employee type is getting access to field field which are present in child class please help!!!!

arun
Автор

Haven't you thought The TPC concept?

amirkian