N
N
no0b2016-03-26 22:44:17
Database
no0b, 2016-03-26 22:44:17

One table, multiple entities (Entity framework) Is it possible?

There were 2 tables in the database (storage and storage element). There were many different tables associated with these tables, most of which are the same. I was advised to merge the "Storage" and "Item" tables and just add the "Type" and "Parent Item (Storage)" field. I liked this option, but the following problem arose: in the application I will have to somehow process this data + although these tables have the same fields and related tables, they also have different related tables. I would like to somehow make it so that I have several entities that will refer to one table depending on the type. Is it possible to implement this using Ef?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-03-28
@no0b

Yes, in EF it's called Table per Hierarchy (TPH), you can read it here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question