public static T CallAccessService <T>(Func <IAccessService, T> call) { AccessServiceClient client = ClientFactory.CreateClient <AccessServiceClient, IAccessService>(); try { return(call(client)); } finally { try { client.Close(); } catch (Exception) { client.Abort(); } } }
public static void CallAccessService(Action <IAccessService> call) { AccessServiceClient client = ClientFactory.CreateClient <AccessServiceClient, IAccessService>(); try { call(client); } finally { try { client.Close(); } catch (Exception) { client.Abort(); } } }