Using EntLib with BizTalk.

1) Create a new c# project and add all the necessary entlib dlls that you need. (this will help because we would not be adding references to entlib dlls for every biztalk project.

2) Create static wrappers classes for say Exception handling

  Policy- is the name that you give when you configure the Exception handling block.

public static class Helpers
    {

        public static void LogException(string policy, Exception ex)
        {
            ExceptionPolicy.HandleException(ex, policy);
        }

    }

3) Add  a reference to the above project in the biztalk project and invoke it as if you are invoking any other .net method

4) Create app.config file using the EntLib tool say BizTalkEnlib.config

5) Modify the BTSNTSvc.exe.config to include the following section right under the configuration node
 <configSections>
    <section name=”enterpriseLibrary.ConfigurationSource” type=”Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
  </configSections>

6)Include the following right before the close of the configuration node

 <enterpriseLibrary.ConfigurationSource selectedSource=”File Configuration Source”>
    <sources>
      <add name=”File Configuration Source” type=”Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″
        filePath=”C:\Program Files (x86)\Microsoft BizTalk Server 2009\BizTalkEntLib.config” />
    </sources>
  </enterpriseLibrary.ConfigurationSource>

thats it and you are all set to go!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: