Organization of domain objects in DDD using ado entity infrastructure

I have two types of users: parents and children, both are users, and have the same properties, but different methods.

I created a user base class and 2 classes: parent and child, both inheriting the form. A custom base class and each class have several different methods.
The user class is a partial class, because the entity framework model has the same class, because the database has only the "Users" table, neither parents nor children.

Now, when I create an object from the Parent class and try to insert it into the database using the ado " AddObject("Users", (User)_parent)" entity framework , it gives me an error that I am inserting a parent element and that nothing needs to be inserted with this identifier.

So, is there something wrong with my domain-driven project, or should I edit something in the entity structure?

+3
source share
1 answer

Table Per Hiearchy (TPH). , , . , .

Parent Kid ( ). , - , EF , . Kid . TPH EF.

+2

Source: https://habr.com/ru/post/1762135/


All Articles