Adding EnterpriseLibraryCoreExtension to Config file

Feb 16, 2011 at 6:24 AM

Hi All,

I am creating the Unity container instance and configuring it by calling the LoadConfiguartion() methods, which inturn reads the web.config file.

ICustomerBLComponent blObj;

using (IUnityContainer container = new UnityContainer ())
   container.AddNewExtension<ExceptionHandlingBlockExtension>();  ----- Want this entry to be moved to Web.config file

   blObj = container.Resolve<ICustomerBLComponent>("CustomerBL");

 <unity xmlns="">
    <alias alias="ICustomerBLComponent" type="BL.ICustomerBLComponent, BL" />
    <alias alias="CustomerBL" type="BL.CustomerBL, BL" />
    <container  name="application" >
      <register type="ICustomerBLComponent" mapTo="CustomerBL" name="CustomerBL">
      <!--<extension type="EnterpriseLibraryCoreExtension" />-->    

Adding the extension as above doesn't work. Please guide me if  I have missed out any piece of code in config file.






Feb 16, 2011 at 6:41 AM
Edited Feb 16, 2011 at 6:43 AM

You should define an alias for the EnterpriseLibraryCoreExtension,

<alias alias="EnterpriseLibraryCoreExtension" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity.EnterpriseLibraryCoreExtension, Microsoft.Practices.EnterpriseLibrary.Common"/>

otherwise, specify its full type name in the type attribute of the extension element.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Feb 16, 2011 at 6:49 AM

Can you please support with some code sample, as to how to define a alias for this. Also reference to any documentation on  adding Extension to Unity container will be of great help to me.

Thanks for the support.



Feb 16, 2011 at 6:55 AM

I posted how the alias should look.  If you add it to your config, and uncomment the <extension type="EnterpriseLibraryCoreExtension" /> it should now work.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.