开发者

Easiest way to check if method is auto-implemented by Castle DynamicProxy

开发者 https://www.devze.com 2023-01-27 03:19 出处:网络
I\'m looking for the easiest way to check if a开发者_C百科 method on my proxy has been auto-implemented by DynamicProxy. That is, let\'s say when registering my component, I added some AdditionalInter

I'm looking for the easiest way to check if a开发者_C百科 method on my proxy has been auto-implemented by DynamicProxy. That is, let's say when registering my component, I added some AdditionalInterfaces, and in my interceptor, I only want to intercept the method if that interface was auto-implemented on the proxy and will simply throw a NotImplementedException if I call .Proceed(). I can think of some crude ways to check this using the ComponentModel, but I was hoping there might be something easy/straightforward.

Thanks!


Use IProxyGenerationHook to only proxy the methods you want to intercept.

0

精彩评论

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

关注公众号