SQLAuthority News – Guest Post – FAULT Contract in WCF with Learning Video

Posted by pinaldave on SQL Authority See other posts from SQL Authority or by pinaldave
Published on Sat, 29 May 2010 01:30:51 +0000 Indexed on 2010/05/29 1:34 UTC
Read the original article Hit count: 778

This is guest post by one of my very good friends and .NET MVP, Dhananjay Kumar. The very first impression one gets when they meet him is his politeness. He is an extremely nice person, but has superlative knowledge in .NET and is truly helpful to all of us.

Objective:

This article will give a basic introduction on:

  1. How to handle Exception at service side?
  2. How to use Fault contract at Service side?
  3. How to handle Service Exception at client side?

A Few Points about Exception at Service

  1. Exception is technology-specific.
  2. Exception should not be shared beyond service boundary.
  3. Since Exception is technology-specific, it cannot be propagated to other clients.
  4. Exception is of many types.
  • CLR Exception
  • Windows32 Exception
  • Runtime Exception at service
  • C++ Exception
  1. Exception is very much native to the technology in which service is made.
  2. Exception must be converted from technology-specific information to natural information that can be communicated to the client.

SOAP Fault


FaultException<T>

  1. Service should throw FaultException<T>, instead of the usual CLR exception.
  2. FaultException<T> is a specialization of Fault Exception.
  3. Any client that programs against FaultException can handle the Exception thrown by FaultException<T>.
  4. The type parameter T conveys the error detail.
  5. T can be of any type like Exception, CLR Type or any type that can be serialized.
  6. T can be of type Data contract.
  7. T is a generic parameter that conveys the error details.

You can read complete article http://dhananjaykumar.net/2010/05/23/fault-contract-in-wcf-with-learning-video/

Reference: Pinal Dave (http://blog.sqlauthority.com)


Filed under: SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology

© SQL Authority or respective owner

Related posts about sql

Related posts about SQL Authority