locked
MVP Design Pattern with a Domain Object with 30 Fields :( RRS feed

  • Question

  • Hi,
    I am trying to implement a site(Read/Update/Delete operations site) using MVP pattern. Also trying to keep the presentation layer UI agnostic(i.e. Presentation layer should work with a Web Client/Windows Client).
    Now I have a domain object with around 30 fields/attributes and all of these fields are editable in the UI(View).

    I want to propogate the change in any field to the Presentation layer. The only solution I can think of is to define 30 events!!! in the View and 30 handlers in the Presentation layer or define 30 setter methods in the presentation layer for the 30 event handlers in the view.

    Am not comfortable with this design.
    Can any one provide me a solution or a direction on this?
    Tuesday, July 28, 2009 3:24 PM

Answers

  • Hello,

    Can't you design the presentation layer to have 3 events that handles the Read, Update and Delete operations ? so for an Update event you will have an UpdateEventArgs that has methods to update whatever is needed, and so on for each operation you need to perform.

    So in your UI you just have one Update event that has the proper methods to perform an update ?
    Thursday, August 20, 2009 6:34 AM