extensions +extensionConfig

Nov 13, 2009 at 2:50 AM

 

 

Hi all,

I would like to understand what exactly the "extensions" element in configuration and how it is linked to  extensionConfig? I want to know how to interpret the below.

 

<unity>

    <containers>

      <container>

        <extensions>

          <add type="Microsoft.Practices.Unity.InterceptionExtension.Interception,Microsoft.Practices.Unity.Interception, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

          <add type="abc.UnityDataAccessExtension, abc.DataAccess" />

    </extensions>

        <extensionConfig>

          <add name="interception" type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationElement, Microsoft.Practices.Unity.Interception.Configuration, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

            <policies>

              <policy name="AllCalls">

                <matchingRules>

                  <matchingRule name="All" type="some type" />

                </matchingRules>

                <callHandlers>

                  <callHandler name="handler" type="some type" />

                </callHandlers>

              </policy>

              <policy name="some calls">

                <matchingRules>

                  <matchingRule name="some" type="some type" />

                </matchingRules>

                <callHandlers>

                  <callHandler name="handler" type="some type" />

                </callHandlers>

              </policy>

           </policies>

          </add>

        </extensionConfig>

      </container>

    </containers>

  </unity>

Nov 18, 2009 at 1:07 AM

The <extension> element is the same as doing this in the API:

container.AddExtension(new WhateverMyExtensionTypeIs());

it adds a container extension instance.

The <extensionConfig> element is, on the other hand, a catch all extensibility point so that you can add arbitrary stuff to the configuration section for a container. An extensionConfig element is usually, but does not have to be, associated with a container.