Tuesday, March 25, 2014

ServiceContract Name property WCF

This property can give your contract a name which is different from the actual interface name. So this way if you decide to change the interface name of a already running WCF service your client wont break.

Ex:

 [ServiceContract(Name="IGoodbyeService")]

    public interface IHelloService

    {

        [OperationContract]

        string GetMessage(string name);

    }


Now the contract name would be IGoodbyeService rather than  IHelloService.

To verify in the WSDL generated check the porttype property it should be IGoodbyeService

Note: Same can be done for OperationContract as well 

0 comments:

Post a Comment