Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Confused by Inheritance and EF Core

$
0
0

I'm trying to learn EF Core and I've got myself confused about how inheritance works with the code first implementation.  I've created by code first classes e.g.

Class 1 - Card (has a number of fields including an ID)

Class 2 - SpecialCard (inherits from Card but adds another field called SpecialCardText

EF Core migration has created a Discriminator column but there isn't a SpecialCardText column in my Postgres DB.

I've tried to select from the EF using SingleOrDefault and I've got back the one row I added and then tried to pull the SpecialCardText value out and it's returned it correct.  However, what I can't see is where the data actually got stored in the DB.  The Discriminator column has become "SpecialCard" whilst other entires are simply "Card".

Can someone explain how this works and where in the DB the actual values are stored.

Rob


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>