0

特定のメソッドのインターセプターを作成しようとしていますが、苦労しています。アスペクトを特定のメソッドにバインドできません。ほとんどの例が示す機能を作成しますが、それでも機能しません。誰でもこれを行う方法の例を教えてもらえますか? 可能であれば、xml 構成を好みます。

別の質問、私はこのコードを持っています:

<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>

それで...

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

このアスペクトは実行されません。何か不足していますか?aopに間違ったアプローチを使用していますか?

ありがとう

4

1 に答える 1

2

インターセプトできるのは仮想メソッドのみです。

于 2010-01-13T16:44:33.883 に答える