Reputation: 65
I'm building a WCF service, I have written the contract in the IService file and Implemented it in the Service file, The problem shows up when I try to change any of the return values of the methods I have declared and that's because they are being saved behind in the code in CustomersService namespace specifically in the CustomersServiceClient class which is locked and can't be accessed to change.
This is the code I have in the ICustomersService file:
[ServiceContract]
public interface ICustomersService
{
[OperationContract]
CustomerDetails GetCustomerDetails(string customerid);
[OperationContract]
bool VerifyId(string customerid);
}
and the code in the CustomersService file:
public CustomerDetails GetCustomerDetails(string customerid)
{
....
}
public bool VerifyId(string customerid)
{
...
}
and in the CustomerService1 namespace I have this code which has been generated and locked, so any attemp to modify the methods I have in the IService is failling because it's locked here and can't be changed!
public class CustomersServiceClient : ClientBase<ICustomersService>, ICustomersService
{
public CustomersServiceClient();
public CustomersServiceClient(string endpointConfigurationName);
public CustomersServiceClient(Binding binding, EndpointAddress remoteAddress);
public CustomersServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress);
public CustomersServiceClient(string endpointConfigurationName, string remoteAddress);
public CustomerDetails GetCustomerDetails(string customerid);
public bool VerifyId(string customerid);
}
this is serious problem for me I hope you find me some answers.
Upvotes: 0
Views: 510
Reputation: 6018
Web services are slightly more complicated than just referenced assemblies. Proxy classes code is not updated automatically if you change service interface. You need to update it manually every time you changed the contract.
Try this:
WCF also can reuse your contract types if you reference that assembly. In that case changes in data contract will be seen in client immediately. You may find implementation steps in that answer: How to use a custom type object at the client
Upvotes: 1