C# Class Patterns.Interception.DelegateInterceptor

Provides an interceptor that allows its interception logic to be injected; no-op fall-backs are used when no logic has been specified for an interception step.
Inheritance: IInterceptor
Show file Open project: patterns-group/code-patterns

Public Methods

Method Description
DelegateInterceptor ( Action after = null, Action before = null, bool>.Func condition = null, Action @finally = null, Func onError = null, Action proceed = null ) : System

Initializes a new instance of the DelegateInterceptor class.

Intercept ( IInvocation invocation ) : void

Intercepts the specified invocation.

Private Methods

Method Description
Initialize ( Action after, Action before, bool>.Func condition, Action @finally, Func onError, Action proceed ) : void

Method Details

DelegateInterceptor() public method

Initializes a new instance of the DelegateInterceptor class.
public DelegateInterceptor ( Action after = null, Action before = null, bool>.Func condition = null, Action @finally = null, Func onError = null, Action proceed = null ) : System
after Action /// The action to execute after proceeding. This action will not run /// if the invocation throws an exception. ///
before Action The action to execute before proceeding.
condition bool>.Func /// The interception condition. If this condition returns false, /// the invocation proceeds with no further interception. ///
@finally Action
onError Func The function to execute when an error occurs.
proceed Action The action to execute. Only set this if proceeding as normal is not desired.
return System

Intercept() public method

Intercepts the specified invocation.
public Intercept ( IInvocation invocation ) : void
invocation IInvocation The invocation.
return void