I have 2 WCF services. Service A contains a definition of type MyEntity. Service B contains a service link to service A and therefore can use a type for MyEntity. So I have a method that looks like this:
protected void Update (ServiceA.MyEntity entity)
{
}
Now I want to use this method in service A, so I added a service reference for service B and tried:
protected UpdateServiceB(MyEntity entity)
{
using(ServiceB.ServiceClient client = new ServiceB.ServiceClient())
{
client.Update(entity);
}
}
This did not work and complained that the types did not match, although Service B uses the type defined in Service A. How can I solve this?
UPDATE
I avoided the issue due to time limitations and instead passed the MyEntity guide from service A to service B. Then I used the existing “GetMyEntity (Guid entityId)” method in service A to retrieve the object in service B:
protected void Update (Guid entityId)
{
MyEntity entity = new MyEntity();
using (ServiceAClient client = new ServiceAClient())
{
entity = client.GetMyEntity(entityId);
}
}