views:

22

answers:

1

I have a WCF service sitting in the cloud. And my application makes several calls to this WCF service. Is it a best practise: 1] to always use return value as bool which indicates if the operation was sucessful or not. 2] returning the values you meant to return as the OUT parameters

A: 

I would:

  • return an atomic value (bool, string, int) if appropriate
  • return a complex type (a class instance) if I need to return more than one value - make sure to mark that class with [DataContract] and its properties with [DataMember]

  • a SOAP fault FaultException<T> when an error occurs; the <T> part allows you to define your own custom error classes, and again - don't forget to mark them with [DataContract] / [DataMember] and declare them as FaultContract on your operations

marc_s