I am attempting to use this workaround for correctly disposing a WCF client so I can wrap the call to client in using statement.
So at my integration layer I added a Service Reference and gave svc address of where my external Service is located.
That created a folder within Service References MyExternalService which contains MyExternalService.disco, MyExternalService.wsdl, Reference.svcmap, etc
Within the Service Reference Folder I created a class called MyExternalServiceClient as below:
public partial class MyExternalServiceClient : IDisposable
{
void IDisposable.Dispose()
{
bool success = false;
try
{
if (State != CommunicationState.Faulted)
{
Close();
success = true;
}
}
finally
{
if (!success)
{
Abort();
}
}
}
}
The problem I am having is that resharper is telling me partial class with a single part. And the State Close and Abort symbols cannot be resolved - even with this.State - the using statements I have at the top of my class are:
using System;
using System.ServiceModel;