"CallResult" class for non-query RPC

In my application I have a service layer which is remoted. There are some functions that are "non-query" methods, that is they do not return a domain entity or collection but perform some action on the server. I would like to get back the result of these calls and possibly any error messages. I am thinking of using a serializable "CallResult" object which has two properties: a boolean "Successful" property indicating if the function executed sucessfully and a "Message" string property containing the message from any exceptions that occured while executing the method. The client would only look at the Message property if the Successful property is false.

I am wondering if this is a good design or not and if there are any common alternatives.

One example would be a something like

Public CallResult AuthenticateUser(Credentials credentials);

If the credentials are valid the server returns a CallResult with a Successful property of true and an empty Message property (or possible a string to store the "ticket" or some such). If not successful, Message would contain the reason, such as "Invalid password", etc.

Thanks for any advice.


Answer this question

"CallResult" class for non-query RPC

  • PiGuy

    test post
  • cippyboy

    I think it is a good option in the context of what you are doing (I would probably go with a different approach altogether and use explicit messages for communicating to/from the services - but that is another story)

    Arnon



  • "CallResult" class for non-query RPC