Using AspectPriority

I am using PostSharp 2.1.5.1 and today warn:

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

It seems to me that the following line raises this warning:

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

Can someone point me to a valid use case AspectPriority? Are the following examples relevant?

Thank.

+5
source share
1 answer

Proper use is AttributePriority. Lower values ​​have higher priority or aspects that apply first.

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

}

Priority priority is not valid for a while. AspectDependencyAction defines a β€œpriority” between two aspects. Value if Aspect1 depends on Aspect2, then AspectDependencyAction.Order = After Aspect1 is applied after applying Aspect2. but this is not what you are looking for (I think). Use AttributePriority instead.

+4
source

All Articles