开发者

Windsor Method interception (AOP)

开发者 https://www.devze.com 2022-12-16 11:54 出处:网络
I\'m trying to create interceptors for specific methods but I\'m having a hard time. 开发者_运维百科I can\'t bind an aspect to a specific method. I create the faicilities most of examples show but it

I'm trying to create interceptors for specific methods but I'm having a hard time. 开发者_运维百科I can't bind an aspect to a specific method. I create the faicilities most of examples show but it still doesn't work. Can anyone give me an example of how to do this? I prefer xml conifguration, if possible.

Another question, I have this code:

<component id="SampleAspect"
           service="WindsorSample.Aspect.SampleAspect, WindsorSample" 
           type="WindsorSample.Aspect.SampleAspect, WindsorSample">
</component>

<component id="HtmlTitleRetriever"
           type="WindsorSample.DummyObject, WindsorSample">
  <parameters>
    <interceptors>
      <interceptor>${SampleAspect}</interceptor>
    </interceptors>
  </parameters>
</component>

Then...

IWindsorContainer container = new WindsorContainer(new XmlInterpreter());
IDummyObject retriever = container.Resolve<DummyObject>();
retriever.SomeMethod();

This aspect is not executed. Am I missing something? Am I using the wrong approach for aop?

Thanks


You can only intercept virtual method, you know that, right?

0

精彩评论

暂无评论...
验证码 换一张
取 消