setting up an interceptionBehavior configuration that has parameters in its constructor

Sep 11, 2012 at 8:25 PM

Hello,

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){ ... }

Thanks!

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">
        <constructor>
          <param name="a" value="99"></param>
          <param name="b" value="The quick brown fox jumps over the lazy dog."></param>
        </constructor>
      </register>

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Sep 11, 2012 at 8:44 PM

Awesome, thanks!