Data Transfer Objects RRS feed

  • Question

  • Hi, 

    I'm developing a WinForm's application based on MVP design pattern. I'd like to use DTO objects, instead of the business objects, for these purposes:

    1) Sending only required data to the presentation layer;

    2) Implementing INotifyPropertyChanged interface for the instant UI updates;

    3) For passing data between layers in an efficient way.

    As I see all three layers must have access to these objects. Should I place these objects in the separate layer which will be referenced by all other layers?

    Any advice on MVP would be so appreciated. Actually this is my first real life application based on this design pattern and contains a way more options and questions for me than any of the examples on the web.

    Thanks in advance,


    Clarity VS Precision

    Friday, July 13, 2012 1:00 PM


All replies

  • Yep, you should :) )

    Clarity VS Precision

    Friday, January 11, 2013 6:33 AM
  • To play devils advocate. Why use a DTO for that? You can serialize an object to only its properties for transport. A view model is better for UI and notification. So why use a DTO?


    Monday, January 14, 2013 11:33 AM
  • Hi,

    In most cases, where you have just fields to display on the wizard, the view model is better and sufficient but imagine this scenario:

    In addition to fields you a list of items that can be added, edited and deleted on the view.

    Instead of persisting each action on a particular item in the list, it'd be better to use DTO for it (and BindingList<DTO>)

    All the actions would occur on the client side and only the final result would persist.

    I use DTOs for passing data in multitier scenarios as well, when WCF is involved.

    Thanks for the question, hope my answer will serve as a justification :)


    Clarity VS Precision

    Wednesday, January 16, 2013 6:25 AM
  • "now is the age of Wpf" - hmm, that's an interesting statement. However, whilst it is fair to question if WinForms is the correct presentation technology (and it easily could be) I'm not sure if those who coined MVP really had WPF in mind...actually I'm very sure they didn't. Overall I'm not really sure if the idea of these posts are to encourage people to look into Indian IT or reject it out of hand?



    Monday, January 28, 2013 10:18 AM