Search code examples
castle-windsoraopioc-containerinterceptorcastle-dynamicproxy

Castle Windsor Interceptor for private/protected method


Is it true that in order for castle windsor's interceptor to intercept a method, that method needs to be declare public?


Solution

  • No it is not true.

    The method must be accessible for generated proxy type, which means it must be virtual (or interface method) and it must not be private.

    So protected and protected internal methods are good to go. Also internal methods from assembly visible to generated dynamic proxy assembly are OK.