AspectPriority 的用法
我正在使用 PostSharp 2.1.5.1,今天收到警告:
方面依赖项(定义于 “MyNamespace.MyAspect.MyVerificationAttribute”)将被禁用 未来版本中的简化版。使用方面优先级 相反,财产。
在我看来,以下行导致了该警告:
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, StandardRoles.Tracing)]
有人能给我指出如何使用 AspectPriority
的正确示例吗?以下示例是最新的吗?
http://www.sharpcrafters.com Sharpcrafters.com/blog/post/introducing-postsharp-2-0-3-aspect-dependency.aspx(“旧的好方面优先级”部分)
http://www.sharpcrafters.com /blog/post/Day-3-Applying-Aspects-with-Multicasting-Part-2.aspx(“方面优先级”部分)
谢谢。
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?
http://www.sharpcrafters.com/blog/post/introducing-postsharp-2-0-3-aspect-dependencies.aspx (section "Old Good Aspect Priority")
http://www.sharpcrafters.com/blog/post/Day-3-Applying-Aspects-with-Multicasting-Part-2.aspx (section "Aspect Priority")
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确的用法是AttributePriority。值越低,优先级越高,或者首先应用的方面。
方面优先级已经有一段时间无效了。 AspectDependencyAction 确定两个方面之间的“优先级”。意思是,如果 Aspect1 依赖于 Aspect2,则 AspectDependencyAction.Order = After 则在应用 Aspect2 后应用 Aspect1。但这不是您正在寻找的(我认为)。只需使用 AttributePriority 即可。
The correct usage is AttributePriority. Lower values are higher priority, or aspects that get applied first.
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.