setting up an interceptionBehavior configuration that has parameters in its constructor

Sep 11, 2012 at 8:25 PM


Is it possible to setup an interceptionBehavior in configuration with a behavior that takes some parameters in its constructor?

For example:
<interceptionBehavior type="TestInterceptor"/>

And the TestInterceptor's class constructor looks like this:
TestInterceptor(int a, string b){ ... }


Sep 11, 2012 at 8:43 PM
Edited Sep 11, 2012 at 8:45 PM

Sure, just register the interceptionBehavior with the container and specify the constructor arguments.  Assuming a behavior called TestInterceptor:

      <register type="TestInterceptor">
          <param name="a" value="99"></param>
          <param name="b" value="The quick brown fox jumps over the lazy dog."></param>

Randy Levy
Enterprise Library support engineer 

Sep 11, 2012 at 8:44 PM

Awesome, thanks!