Reading the accepted answer to this question, apparently the right way to use a WCF service is like this (copied with some modification)
// create your client
CustomerClient channel = CreateCustomerClient();
try
{
// use it
channel.GetCustomerDetails() ....
(more calls)
// close it
channel.Close();
}
catch(CommunicationException commEx)
{
// a CommunicationException probably indicates something went wrong
// when closing the channel --> abort it
channel.Abort();
}
However, if my program use the service many times, this will clutter my code a lot. What is the clean way to do this without cluttering my code? Some ideas using lambda expression come to my mind, but so far they don't feel quite clean.