WCF Service Contract Refactoring affects Configuration File in VS2008 SP1
WCF Service Contract Refactoring affects Configuration File in VS2008 SP1
Visual Studio 2008 shipped with several WCF project templates that give a better starting point than an empty project. The WCF Service library creates a project with an initial service contract, a basic service implementation class and some basic configuration settings in the configuration file.
The thing was, that you would probably want to change the name of the service contract, the service implementation name and the names of the related files. But what you should not forget is to change the configuration file and apply the changes there as well.
One of the IDE improvements in Visual Studio 2008 SP1 allows you to easily refactor your WCF elements, and it will take care of the change for you. For example, if I now change the service contract file name to IHelloService.cs, the following changes will take place:
- The name of the service contract interface will be changed to IHelloService
[ServiceContract]
public interface IHelloService
{
...
}
- It will be updated in the service implementation file
public class Service1 : IHelloService
{
...
}
- New in VS 2008 SP1: The configuration file will be updated as well
<service name="WcfServiceLibrary1.Service1">
<endpoint address="" binding="wsHttpBinding"
contract="WcfServiceLibrary1.IHelloService">
</service>
Nice feature!