11
I was exchanging comments with two users here at SOPT
about DDD
and Entity Framework
.
I said that DDD
and Entity Framework
are not mutually exclusive.
Or are they?
References:
11
I was exchanging comments with two users here at SOPT
about DDD
and Entity Framework
.
I said that DDD
and Entity Framework
are not mutually exclusive.
Or are they?
References:
4
By no means!
The DDD states that domain entities should not be aware of how persistence occurs. But that doesn’t mean it doesn’t exist! At the end of the day persistence is still required. A beautiful layer of domain doesn’t do much by itself.
What should be done if you practice DDD is to ensure that your software architecture is well designed and above all separated into well-defined layers.
Domain entities must play in one corner and persistence entities in another, linked (preferably) through data transfer Objects(DTO’s).
In short, the DDD focuses on the domain area, but does not exclude persistence (EF). They are complementary concepts in the construction of a program.
you have just described a multi-layer architecture, in case 3 layers, but most developers make the mistake of trying to see the persistence layer as being a project of your solution, when in fact it is simply the DBMS. So imagine a SPA application made with Angularjs and Webapi making persistence in SQL Server, Angularjs is the presentation layer, Webapi is the domain (and EF is its component) and SQL Server is the persistence layer.
@Tobymosque SQL Server
It’s not the persistence layer, it’s just a database. Where the data persists. A persistence layer usually abstract database links, query strings, queries and commands parameters, transformation of a record
for a model and a thousand and one more things. In other words, they abstract ADO.net (in the case of c#
)
@Tobymosque In your example EF
would be the layer of persistence and nothing else. In fact she is just that.
2
DDD is a software modeling approach that follows a set of practices aimed at facilitating the implementation of complex rules/business processes that we treat as a domain.This approach does not depend on any technology to be built is also not a technology.
Repository Pattern can be used in conjunction with DDD in the Infrastructure layer without any problem.
Browser other questions tagged entity-framework ddd
You are not signed in. Login or sign up in order to post.
You can link these comments as well?
– Jéf Bueno
@jbueno comments cannot be linked (as far as I know) but I will include in the question.
– Bruno Costa
Of course they can. Just copy the link at the last minute of the comment.
– Jéf Bueno
@jbueno. Ah thanks. Done.
– Bruno Costa
DDD is not technology or layers. Focus on DDD http://eduardopires.net.br/2016/08/ddd-nao-e-architecture-layered/
– user26552