English 中文(简体)
Castle. Windsor 每类多重拦截器
原标题:Castle.Windsor multiple Interceptors per class

< a href=> http://docs.castleproject.org/%28X%281%29S%28faqxvazfuvdoeq55231oyo45%%29/Windsor. 干涉器. ashx" rel=“不跟随 noferrer” > Documentation 表示,我可以应用多个 < code> 干涉器 属性。然而,我还是会得到一个语法错误 复制属性 < /em> 。 还有 < href=" https://stackoverflow.com/ questions/ 101555/aop-caching- with-castle- windowsorlencesor > > > 。 这个 < a > post 表示我可以对方法应用截击器,但是我只能将它们应用到该类中。

[Interceptor (typeof (CastleWindsorAspect))]
[Interceptor (typeof (AnotherCastleWindsorAspect))]
public class CastleWindsorDomainType { }
最佳回答

您确实可以将多个截击器应用到一个组件中。您可以使用流利的注册 API 和 XML 配置来做到这一点。

您也应该能够通过自定义属性( 如您演示的那样) 完成它, 但是在 Windsor 中似乎会出现一个错误, 它不允许您多次指定它( 因为您看到错误 ) 。 我建议将此报告为错误, 并同时使用注册 API 附加多个干扰器 。

至于将拦截器应用到您可以使用的方法, 但不是声明。 相反, 您需要指定 < code> IProxyGenerationHook 或 < code > I interphysers selector 来控制哪些方法应该被替代和( 或) 哪些拦截器应该应用到哪种替代方法 。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...