Data Transfer Objects in Domain-Driven Design Patterns

Data Transfer Object. A simple pattern for exchanging information between the Presentation Layer and the Service Layer.

The basics are explained in lots of articles all over the web, but there are some details that are not so obvious. I implemented DTOs following my instincts, but I always had the feeling I was asuming things and not doing it well.

That’s whay I keep on asking about the insights of patterns like this.

I found a very interesting article about DTOs by Bozhidar. I recommend you to read it because it gives several hints and advices on how to use this pattern sucessfully.

Bozho’s tech blog – On DTOs

The last part I want to notice is the question I posted. As you see, Bozher was really kind and answered really quick.

Thanks!

4 pensamientos en “Data Transfer Objects in Domain-Driven Design Patterns

    • Thanks for your comment! Fixed🙂 By the way, I’m thinking about writing a series of articles about patterns that are used in Domain Driven Design. I think the next one will be the Value-Object. Have you worked with NHibernate or Entity Framework?

        • By the way, one question:
          I ever wondered how to add a relationship from entity to another in the Service layer. For example: Adding a Payment to a User.

          * paymentService.makePayment(userId, paymentDto)?

          * paymentService.makePayment(userDto, paymentDto)?

          * userService.makePayment(userId, paymentDto)?

          What one, if any, sounds good to you? Is passing Ids to methods a good practice? Shouls a service retrieve DTOs or entities from the model?
          Thanks!

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s