Contents tagged with Entity framework
today I want to share some strange behaviour that I faced.
Recently I needed to switch from .Net core 1.1 web app to .Net core 2.0 app.
I found over internet that simplest way to achieve it will be just opening project in Visual Studio 2017 and VS will switch your project by itself. I decided to give to such attempt a try.
Initially all went fine. Visual Studio 2017 gave me very nice looking report which convinced me that life is easy and wonderful. Actually it said that project was switched to .Net core 2.0 with success.
Then I've tried to execute in package manager console Update-Database command. Unfortunately I've seen following error message:
An error occurred … more
today I want to write about reflecting hierarchy of classes in db with help of code-first.
There are three types:
Table per Hierarchy
Table per Type
Table per conreate class.
Below goes more detailed description
Table per Hierarchy (TPH): one table for the entire class inheritance hierarchy. Table includes discriminator column which distinguishes between inheritance classes. This is a default inheritance mapping strategy in Entity Framework.
Table per Type (TPT): This approach suggests a separate table for each domain class.
Table per Concrete class (TPC): one table for one concrete class, but not for the abstract class. So, if you inherit the abstract … more