Answer the question
In order to leave comments, you need to log in
How to get data of inherited class in EF 6?
Good day to all!
How to get inherited objects in EF?
For example:
class Phone
{
public int Id { get; set; }
public string Name { get; set; }
public double Price { get; set; }
}
class IPhone : Phone
{
public string Manufacturer { get; set; }
}
public void Create()
{
var phone = new Phone();
var iphone = new Phone();
Phones.Add(phone);
Phones.Add(iphone);
}
Answer the question
In order to leave comments, you need to log in
You will study for a start mapping in the database of 3 types during inheritance.
TPH, TPT, TPC
https://msdn.microsoft.com/en-us/data/jj591617.aspx
metanit.com/sharp/entityframework Chapter 7. Inheritance in the Entity Framework
See how it is stored in the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question