Design Pattern Framework 3.5
DoActionAndClose<(Of <(T>)>) Method (client, action)
Patterns-In-Action! Application ► WCFProxy ► SafeProxy ► DoActionAndClose<(Of <(T>)>)(T, Action<(Of <(T>)>))
Used in environments where WCF proxies are created and closed all the time.
In case something goes wrong it aborts (immediately closes) the communications.
Declaration Syntax
C# | Visual Basic |
public static void DoActionAndClose<T>( T client, Action<T> action ) where T : ICommunicationObject
Public Shared Sub DoActionAndClose(Of T As ICommunicationObject) ( _ client As T, _ action As Action(Of T) _ )
Generic Template Parameters
- T
- Type parameter.
Parameters
- client (T)
- The client.
- action (Action<(Of <(T>)>))
- The typed action.
Remarks
Design Pattern: Proxy
As an alternative one could implement proxy pooling to increase performance.