InterceptMethods<TScope>(IAdviser<TScope>, Func<IMethodInterceptionBuilder, IMethodInterception>)
Registers the interception of the uses of methods, described by a delegate.
Declaration
public static void InterceptMethods<TScope>(this IAdviser<TScope> adviser, Func<IMethodInterceptionBuilder, IMethodInterception> build) where TScope : class, IDeclarationParameters
| Type | Name | Description |
|---|---|---|
| IAdviser<TScope> | adviser | An adviser whose target is the scope declaration. |
| Func<IMethodInterceptionBuilder, IMethodInterception> | build | A delegate that receives an IMethodInterceptionBuilder, selects the intercepted methods, chooses how the
calls are intercepted, and returns the resulting IMethodInterception, for instance
|
Type Parameters
| Name | Description |
|---|---|
| TScope |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | The delegate returned |
| InvalidOperationException | The delegate discarded a value that it created, or the project that executes the registration
does not reference the |
InterceptMethods(ITypeAmender, Func<IMethodInterceptionBuilder, IMethodInterception>)
Registers the interception of the uses of methods, described by a delegate. The scope declaration is the type of the fabric.
Declaration
public static void InterceptMethods(this ITypeAmender amender, Func<IMethodInterceptionBuilder, IMethodInterception> build)Parameters
| Type | Name | Description |
|---|---|---|
| ITypeAmender | amender | The amender of a type fabric. |
| Func<IMethodInterceptionBuilder, IMethodInterception> | build | A delegate that describes the interception, as in InterceptMethods<TScope>(IAdviser<TScope>, Func<IMethodInterceptionBuilder, IMethodInterception>). |
Remarks
This overload resolves the ambiguity between the IAdviser<T> and IQuery<TDeclaration> overloads for ITypeAmender, which implements both interfaces. The registration is made through the query.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | The delegate returned |
| InvalidOperationException | The delegate discarded a value that it created, or the project that executes the registration
does not reference the |