Home » » How to deal with operation overloading while exposing the WCF services?

How to deal with operation overloading while exposing the WCF services?

Written By M.L on திங்கள், 22 ஆகஸ்ட், 2011 | ஆகஸ்ட் 22, 2011

By default overload operations (methods) are not supported in WSDL based operation. However by using Name property of OperationContract attribute, we can deal with operation overloading scenario.

[ServiceContract]
interface ICalculator
{
   [OperationContract(Name = "AddInt")]
   int Add(int arg1,int arg2);

   [OperationContract(Name = "AddDouble")]
  double Add(double arg1,double arg2);
}
Notice that both method name in the above interface is same (Add), however
the Name property of the OperationContract is different. In this case client proxy will have two methods with different name AddInt and AddDouble.

0 comments:

கருத்துரையிடுக

Popular Posts

General Category