Akim
Akim

Reputation: 8669

Usage of AspectPriority

I'm using PostSharp 2.1.5.1 and had a warning today:

Aspect dependencies (defined on "MyNamespace.MyAspect.MyVerificationAttribute") will be disabled from the Starter Edition in future versions. Use the AspectPriority property instead.

Seems to me that following line is causing that warning:

[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, StandardRoles.Tracing)]

Could someone point me to a correct example of how to use AspectPriority? Are the following examples up to date?

Thanks.

Upvotes: 5

Views: 1713

Answers (1)

Dustin Davis
Dustin Davis

Reputation: 14585

The correct usage is AttributePriority. Lower values are higher priority, or aspects that get applied first.

[Trace(AttributePriority = 2)]
[HandleError(AttributePriority = 1)]
public void MyMethod()
{

}

Aspect Priority hasn't been valid for a while. AspectDependencyAction determines the "priority" between two aspects. Meaning, if Aspect1 depends on Aspect2 then and the AspectDependencyAction.Order = After then Aspect1 gets applied after Aspect2 has been applied. but that isn't what you are looking for (I think). Just use AttributePriority instead.

Upvotes: 4

Related Questions