Request Response DTO pattern WCF RRS feed

  • Question

  • Hi,

    I like to implement Request/Response pattern for WCF methods. But the problem for doing is for every method I have, I need to create 2 classes (Request/Response). Since we have a lot of methods we will have twice the number of classes and it becomes hard to maintain.

    So the question , is there a better way to do this or is this is the only way.

    for ex:

    User GetUserById(long id)

    List<User> SearchUserByName(string userName)

    So in this simple example do we end up creating 4 classes or can we do something else.

    If there is an automation process to create the wrapper class, thats also fine.


    This is first time I am have been given a task likes this, so not sure which way to go.








    Tuesday, July 13, 2010 1:17 AM

All replies

  • In my experience there isn't really a way around this.  Often you would have a base response DTO for example which would contain certain elements that would be common to all responses such as errors, ip of the response, etc.  Then for each method you would inherit from that base and add your own specific properties to it.
    Tuesday, July 13, 2010 12:30 PM