Open sandboxFocus

Class GroupingAdvice

Base class for the advices that can be grouped with other advices of the same family, so that they are woven as one transformation.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public abstract class GroupingAdvice : Advice
Remarks

Advices of the same family, for example OnMethodEntryAdvice and OnMethodExitAdvice, can be grouped so that they are woven as a single transformation, consistent with the code generated by the corresponding simple aspect, such as OnMethodBoundaryAspect. The advices of a group share their arguments, such as MethodExecutionArgs.

The groups are formed in each class of the aspect separately. An advice without Group, Master and pointcut joins the group of its class that has no advice of its kind yet. When there is no such group, the advice starts a group that applies to the target of the aspect. When there are several, the compiler reports an error, and Group must be set. An advice with a pointcut and without Group or Master starts a group of its own.

The pointcut of a group, and the properties that apply to the whole group, such as Description, can be set on any advice of the group, but on one advice only.

Constructors

Name Description
GroupingAdvice()

Properties

Name Description
Group

Gets or sets the name of the group of the current advice. The advices of the aspect that have the same value form one group, whatever the class that declares them.

Master

Gets or sets the name of an advice method whose group the current advice joins. This property is obsolete: set Group on all the advices of the group instead.

See Also