WCF – Painstaking (Hard to find)

 

In writing WCF methods, remember one thing, it will relief you from a lot of pain you may later have take.

In the method argument signature always define different names for argument variables for different methods. As if you are defining all arguments in the same scope.

For example-

public interface ITradesService
    {
        [OperationContract]
        int DoWork(int a);

        [OperationContract]
        int DoAnotherWork(string a);

}

This will lead WCF misunderstand both operations take int type argument which you can eliminate the confusion by writing different variable name (not the same as wriiten a)

public interface ITradesService
    {
        [OperationContract]
        int DoWork(int a);

        [OperationContract]
        int DoAnotherWork(string b);

}

Comments