Open sandboxFocus

Interface IMethodInterceptionBuilder

The first stage of the description of a method interception, which the delegate given to InterceptMethods receives. It sets where the call sites are, and then selects the type that declares the intercepted methods.

Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IMethodInterceptionBuilder
Remarks

A description is a chain of immutable values: each method returns a new value, and the value on which it is called is unchanged. The delegate returns the last value of the chain, and every value that the delegate creates must be part of the returned chain. A value that is created and then not used, for instance interception.WithGranularity( … ); without an assignment, is an error, which is reported when the delegate returns. A chain can contain at most 64 values.

The stages are, in order: where the call sites are (this interface), what is called (ITypeSelection and IMethodSelection), how the call is intercepted (IMethodResultFactory), and how the interceptor method is generated (ITemplateInterception).

Methods

Name Description
ExcludingLambdas()

Excludes the call sites in lambda expressions, anonymous methods and local functions.

IncludingNestedTypes()

Includes the call sites in the types nested in the scope type. By default, a type scope contains only the members that the type itself declares.

Type(INamedType)

Selects the type of the code model that declares the intercepted methods.

Type(Type)

Selects the type, given as a reflection Type, that declares the intercepted methods.

Types(Func<INamedType, bool>)

Selects the types that declare the intercepted methods with a predicate over type definitions.

Extension Methods