This project is read-only.

How to shield exception information with fault contracts

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

Use the following steps to shield exception information with fault contracts
  1. Define a Fault contract by applying the FaultContract attribute directly on a contract operation, and specifying the error detailing type to the Divide method as shown below:
interface ICalculator

   double Divide(double number1,double number2);

  1. Implement the Divide operation which throw the fault and have it propagated to the client by throwing exactly the same detailing type listed in the fault contract.
class MyService : ICalculator
   public double Divide(double number1,double number2)

      throw new FaultException<DivideByZeroException>(new DivideByZeroException());

Last edited May 8, 2008 at 4:31 AM by prashantbansode, version 1


No comments yet.