Open sandboxFocus

Interface IInterceptionInfo

Describes the interception that a template implements. A template reads it through the meta.Interception property.

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

The generated method is shared by the call sites that have the same template, arguments, tags, placement, granularity and signature. The Granularity property decides which context of the call sites the template can read: the CallingType, CallingMember, Caller and Source properties throw an InvalidOperationException when the granularity is too coarse. Information that differs between the call sites that share the method, for instance the line of the call, can also be passed to the template as an added parameter, through WithArgs(object) or SetArgument(IParameter, IExpression), which does not split the method.

The template reads the generated method through the meta.Target.Method property. The generated method and its class are not visible through the members of the compilation, because they are added when the code is linked.

Properties

Name Description
Caller

Gets the code that contains the call site of the generated method: the member, the kind of code and the function.

CallingMember

Gets the member that contains the call sites of the generated method, as defined by the Member property.

CallingType

Gets the type that contains the call sites of the generated method.

Granularity

Gets the granularity of the interceptor, as WithGranularity(InterceptorGranularity) set it.

Kind

Gets the kind of interception.

Method

Gets the details of the interception of a method call.

Source

Gets the source of the call site of the generated method: the invocation expression or the method group.

Extension Methods