What is the use of using another model with Entity Framework in DDD

When I look at some application projects for DDD, I see that the object generated from the entity structure is used only to access the data warehouse. After loading the data, it is mapped to another POCO object defined in the application model.

Is it just a good design and made for design? Or is there some added value to override the entire application model and not use the generated objects? If so, if any of you have already done some research on this issue, what are the pros and cons of using EF objects at each level of your application, as well as the availability of a different model?

MVC Storefront is an example application that does this (although it uses LINQ to SQL), but it is the same idea.

Thank!:)

+3
source share
2 answers

Separation of problems. POCO allows you to remove any EF dependency in your domain model. It is unlikely, but if you come across a technical brick wall with EF, there will be less effect when switching to another ORM / DAL.

+2
source

This method is called DTO (data transfer objects) and completely disables data access mechanisms from any other parts of the system.

, ( , POCOs EF4, DTO), , , , , , POCOs / DTO.

+1

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


All Articles