Fault Contract Interview Questions and Answers Supported Blog’s and other interview Questions
1) What is Fault Contract ?
Ans) It is a attribute need to be decorated on top of the Method definition in Interface.
public interface IMathService
[FaultContract(typeof(CalculationDetails))] double Division(long a, long b);
2) Why I need to user typeof() keyword in Fault Contract ?
Ans) If you want use FaultContract attribute it is mandatory to define type with some DataContract class.
3) What is difference between Fault Contract and Fault Exception ?
Ans) Fault Contract is a class need to decorate on the top of the method definition in interface and Fault Exception is class will be come as the part of try & catch block.
4) Is it mandatory if I want to use Fault Exception class I need to decorate Fault contract attribute to method definition ?
Ans) Yes. You can use only Fault Exception when you declare Fault Contract attribute.
5) Can I through Fault Exception in try block it self like through new Exception(..) ?
Ans) Yes, you can through exception in try block.
throw new FaultException(CalculationDtls);
6) Is it possible to throw Fault exception in Catch ?
7) Can I use any DataContract Class as type of Fault Contract ?
Ans) Yes. You can use any of the DataContract class.
7) Where can I find full blog of this topic ?
Ans) You can find on top the article link.