5

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.

Ryan Shripat
  • 5,574
  • 6
  • 49
  • 77
Akim
  • 8,469
  • 2
  • 31
  • 49

1 Answers1

4

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.

Dustin Davis
  • 14,482
  • 13
  • 63
  • 119
  • Thanks. Similar answer as I also have at [SharpCrafters Forum](http://www.sharpcrafters.com/forum/Topic7822-17-1.aspx#bm7827) – Akim Nov 03 '11 at 09:44
  • 3
    @DustinDavis - In one of your blog posts, you note that "using AttributePriority is not considered best practice, because it quickly becomes difficult to manage. We'll see another day how to address this issue in a clean and robust way." Is that the aspect dependencies feature from the commercial version, or is there a better way? – Remi Despres-Smyth Oct 26 '12 at 18:37