/// <summary> /// Calls the specified client action by creating a client instance using the specified service client provider. /// </summary> public static void Call <TChannel>(this IServiceClientProvider <TChannel> provider, Action <TChannel> action) where TChannel : class { var channel = provider.CreateChannel(); using (channel.AsDisposable()) { action(channel); } }
/// <summary> /// Calls the specified client function by creating a client instance using the specified service client provider. /// </summary> public static TResult Call <TChannel, TResult>(this IServiceClientProvider <TChannel> provider, Func <TChannel, TResult> func) where TChannel : class { var channel = provider.CreateChannel(); using (channel.AsDisposable()) { var result = func(channel); return(result); } }