推薦個很是簡單好用的AOP -- MrAdvice

 

 

https://github.com/ArxOne/MrAdvicegit

 

太簡單了,寫好本身的處理類, 做爲Attribute加到要攔截的方法或者類上就能夠了。github

 

Here is the minimal sample:this

public class MyProudAdvice : Attribute, IMethodAdvice { public void Advise(MethodAdviceContext context) { // do things you want here context.Proceed(); // this calls the original method // do other things here } }

You then just need to mark the method(s) with the attribute and that's it, your aspect is injected!spa

[MyProudAdvice]
public void MyProudMethod() { }
相關文章
相關標籤/搜索