Open sandboxFocus

Class AspectDependencyAttribute

Base class for all custom attributes that define aspect dependencies. An aspect dependency determines the behavior of aspects or advices when they are used together with other aspects and advices. Aspect dependencies determine the ordering, requirements, conflicts, and commutativity of aspects and advices.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public abstract class AspectDependencyAttribute : Attribute
Remarks

Apply a derived custom attribute to an aspect class to express a dependency of the aspect, or to an advice method to express a dependency of this advice only. Classes derived from the aspect class inherit its dependencies.

To add a dependency to an aspect class that you cannot modify, for example to order aspects of two third-party vendors, apply the custom attribute to the assembly and set the TargetType property to the aspect class.

Constructors

Name Description
AspectDependencyAttribute(AspectDependencyAction)

Initializes a new instance of the AspectDependencyAttribute class without specifying the position. The position is implicitly Any.

AspectDependencyAttribute(AspectDependencyAction, AspectDependencyPosition)

Initializes a new instance of the AspectDependencyAttribute class and specifies a position.

Properties

Name Description
Action

Gets the dependency action, that is, the kind of relationship that the dependency specifies (Order, Require, Conflict, or Commute).

IsWarning

Gets or sets a value indicating whether the constraint (of type Require or Conflict) should emit a warning instead of an error if it is not respected.

Position

Gets the position of the current dependency. This is the position of the other aspect or advices relative to the aspect or advice that this dependency belongs to.

Target

Gets or sets the target (Default or Type) to which the aspect dependency applies.

TargetType

Gets or sets the aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when the attribute is applied at class or method level.

See Also