May 27, 2010 at 7:38 AM
Edited May 27, 2010 at 7:40 AM
Thank you for your answer.
So specifying additional interfaces means just that I can safely cast my proxy to those interfaces and any calls for methods from those interfaces on my proxy invoke whole interception chain, as with "normal" proxied methods?
Does it mean that if I want to have it done somehow like above, I'll need to check if currently called method is given by the additional interface and if so - call the method and break the chain (to not to get to NotImplementedException finally), otherwise
do normal preprocessing, call getNext etc.?
And if I have more than one behavior in my chain, each adding some pre- and postprocessing rules and adding one additional interface:
- implements IFirstAdditional interface with FirstTest method
- makes pre- and post-processing for calls other than FirstTest
- implements ISecondAdditional interface with SecondTest method
- makes pre- and post-processing for calls other than SecondTest
And now, when casting my proxy to ISecondInterface and calling proxy.SecondTest(), pre- and post-processing from behavior A will be called.
On the contrary, when casting my proxy to IFirstInterface and calling FirstTest(), behavior A will handle it and break the chain, so no pre- or postprocessing will be called.
And that means that only some of the behaviors can be applied to methods specified by additional interfaces?
Do I think right?