WCF Service Method Overloading

You all may have found this one out even earlier, but I found this out just a few days before. A WCF Service doe not allow normal method overloading , which is supported by .NET. It throws InvalidOPerationException.

As for the reasons to why this happens is becasue WSDL is not a object orinted language and does not support these features of OOP. However overloading can be performed in WCF service in a roundabout way.

[ServiceContract]
interface ICalculator
{
[OperationContract(Name="AddTwoIntegers")]
int Add(int a,int b)

[OperationContract(Name="AddThreeIntegers")]
int Add(int a,int b,int c)
}

The Name property in the OperationContract attribute enables the WSDL to make the difference between to same named methods here.

Comments

Popular posts from this blog

Authorize.net Integration eCommerce Payment Gateway ( Direct Post Method New! )

Get Organised with OneNote

Test your Sql Query Online