0

Applying domain driven desing I am confused a bit. I am using C# and Java

I have layers like this:

  • Domain
  • ApplicationService
  • DataLayer
  • PresentationLayer

ApplicationService layer is between presentation and Data layer. AppplicationService gets data from Data layer and converts it a PresentationDTO object and sends to presentation layer.

Do I need a new data transfer object (EntityFrameworkDTO) between ApplicationService and Data layer. Should I generate DTOs to use in repositories, or directly use domain entities in repository layer?

Have you ever applied Domain Driven Design?

barteloma
  • 6,403
  • 14
  • 79
  • 173

1 Answers1

0

In General for complex scenarios when your Model break apart to several views and viceversa, it better to use ViewModel or Data Transfer object to better management for views as needs of Views are something different from domain needs. Now, in Domain Driven Design as your Application Service should play an important role between Repository and Presentation, you have to have DTO as you are going to get the business Objects in you presentation layer from service layer. in other case you have to use Domain entities in you presentation layer which will make your Domain entities Non POCO. hope it helps.

Ehsan
  • 816
  • 9
  • 27
  • I already use DTOs between ApplicationService and Presentation. Should I use different DTOs between Repository and Domain objects. Or directly use domain entity in data layer? – barteloma Jun 01 '14 at 13:03
  • Oh, sorry I thought your in two ways between using in service layer or not. based on my experience on DDD, I've never seen in a project using DTO between Domain and repository as you should make repository for aggregate roots of domain which include other entities and value objects. there is no need IMO – Ehsan Jun 01 '14 at 13:10