2010-12-01 17 views
1

私はCastle Windsorでいくつかのプロジェクトをやっていますが、設定ファイル のインターセプタフックに関するいくつかの問題があります。私はimpages IProxyGenerationHookクラスを作成しました:Castle Windsorインターセプターセレクターとフック

public class LoggingProxyGenerationHook : IProxyGenerationHook 
{ 

    #region IProxyGenerationHook Members 

    public void MethodsInspected() 
    { 
     //throw new Exception("The method or operation is not implemented."); 
    } 

    public void NonVirtualMemberNotification(Type type, System.Reflection.MemberInfo memberInfo) 
    { 
     //throw new Exception("The method or operation is not implemented."); 
    } 

    public bool ShouldInterceptMethod(Type type, System.Reflection.MethodInfo methodInfo) 
    { 
     return methodInfo.Name.StartsWith("Save", StringComparison.Ordinal); 
    } 

    #endregion 
} 

私がしたいのは、 「保存」し、設定ファイルに動的にフックします。

また、設定ファイルには次のものがあります:

<component id="LoggingAspect" type="DynamicInterceptor.LoggingAspect, DynamicInterceptor"></component> 
<component id="LoggingProxyGenerationHook" type="DynamicInterceptor.LoggingProxyGenerationHook, DynamicInterceptor"></component> 
<component id="TestClass1" type="TestClasses.TestClass1, TestClasses"> 
<interceptors hook ="${LoggingProxyGenerationHook}"> 
<interceptor>${LoggingAspect}</interceptor> 
</interceptors> 
</component> 

私は設定ファイルに何か間違っていると思います。 どんなアイデアですか?

+1

あなたは期待していたことはありませんか? –

+1

フィルタリングしていないということはどういう意味ですか?呼び出されていないか、その戻り値が無視されていますか?または、他の何か?あなたが誰かを助けてくれるようにしたいなら、もっと精巧にしてください。推測を残さないでください。 –

+1

@nikolavas:これは公正なことではありません。 Krzysztofは城に関する多くの時間と労力を費やしており、城のドキュメンテーションを多く改善しています。 –

答えて

2

Works for me.(ウィンザー/コア2.5.2)

+0

おそらく、問題はCastleのバージョンです。私はバージョン2.0(.netフレームワーク2.0と互換性があります)を使用しています。あなたの答えをありがとう。 – nikolavas

+0

@Mauricio Scheffer、この質問に注意を払ってくださいhttp://stackoverflow.com/q/10547690/800261。どうもありがとう。 –