Part 5 How to make changes to wcf service without breaking clients04:33

  • 0
Published on September 3, 2017

Link for code samples used in the demo

Link for all dot net and sql server video tutorial playlists

Use Name property of ServiceContractAttribute and give it an explicit name to prevent the clients from breaking when you change the service contract interface name.

We have not used Name property of the ServiceContractAttribute in the example below.
[ServiceContract]
public interface IHelloService
{
[OperationContract]
string GetMessage(string name);
}

Later if we change the interface name from IHelloService to IHelloServiceChanged, this would break the existing clients consuming your wcf service. In order to prevent this from happening use Name property as shown below.
[ServiceContract(Name = “IHelloService”)]
public interface IHelloServiceChanged
{
[OperationContract]
string GetMessage(string name);
}

In WSDL document, we have something called portType. You can think of this portType as the interface the client uses to communicate with the wcf service. When you don’t set the Name property on a service contract attribute, by default the name of the portType in WSDL will be the name of the service contract interface. If you set an explicit Name for the service contract using Name property then that Name will be used for the portType.

In a similar fashion you can set Name property for an OperationContract as shown below.
[ServiceContract(Name = “IHelloService”)]
public interface IHelloServiceChanged
{
[OperationContract(Name = “GetMessage”)]
string GetMessageChanged(string name);
}

https://cafeadobro.ro/

https://www.stagebox.uk/wp-includes/depo10-bonus10/

depo 25 bonus 25

https://parfumschristianblanc.com/

https://www.barplate.com/wp-includes/js/qris/

https://hotmusic507.org/

Enjoyed this video?
"No Thanks. Please Close This Box!"