Excludes the code of the declaration from interception, or includes it again: when excluded, no site inside the declaration, or inside a declaration that it contains, is presented to any interceptor registration.
Implements
Namespace: Metalama.Extensions.Interceptors
Assembly: Metalama.Extensions.Interceptors.dll
Syntax
[RunTimeOrCompileTime]
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event|AttributeTargets.Interface, Inherited = false)]
public sealed class ExcludeInterceptorsAttribute : Attribute, IHierarchicalOptionsProviderRemarks
The typical use is an interceptor method that calls the method that it intercepts. Without the attribute, the call in the interceptor would be intercepted when the scope of the registration contains the interceptor, and the interceptor would call itself.
The attribute applies to the declaration that carries it and to everything that the declaration contains: the members and nested types of a type, and the lambdas and local functions of a member. A lambda or a local function follows the member that contains it, so the attribute is not honored on a local function. On the assembly, it excludes the whole project. Derived types and overriding members are not excluded by the exclusion of their base.
The attribute is equivalent to InterceptorConfigurationExtensions in a fabric. When a declaration and a declaration that
contains it are configured differently, the configuration of the innermost declaration applies, so [ExcludeInterceptors( false )]
includes a declaration again in an excluded scope.
Constructors
| Name | Description |
|---|---|
| ExcludeInterceptorsAttribute(bool) | Initializes a new instance of the ExcludeInterceptorsAttribute class. |
Properties
| Name | Description |
|---|---|
| Exclude | Gets a value indicating whether the code of the declaration is excluded from interception. |