Reading Configuration Settings at Runtime

Parent Previous Next

Once you've added a setting to the Excel settings spreadsheet, it's readily accessible to your BizTalk application at runtime.


To read a setting value at runtime from maps, orchestrations, pipeline components or .NET code:


1. Complete the steps in Deploy Configuration Settings into SSO

The steps in Deploy Configuration Settings into SSO are all prerequisites to this topic.


2. Copy SSOSettingsFileReader.dll from the Deployment Framework for BizTalk install folder to a reference location in your BizTalk solution

The settings API is housed in a .NET 2.x assembly named SSOSettingsFileReader.dll.  Before you can use it in your application, locate the DLL in <BTDFInstallFolder>\Framework\DeployTools and copy it to a folder within your BizTalk solution folder hierarchy.  It's a good idea to check the DLL into your source control system and reference it in that location vs. the Deployment Framework's install folder.


3. Add a reference to SSOSettingsFileReader.dll to your project

In any BizTalk or .NET project, add a reference to the copy of SSOSettingsFileReader.dll in your solution folder structure.


4. Call the settings API

The SSOSettingsFileReader class has static methods for retrieving an individual value as well as for retrieving a Hashtable for the entire set of name-value pairs.  This class caches the settings and periodically refreshes them from the SSO server.


The affiliateApplication is the value of the <ProjectName> element in your deployment project file (.btdfproj).  The valueName is the name of a setting (row) in the spreadsheet.


namespace SSOSettingsFileManager

{

   public class SSOSettingsFileReader

   {

       public static void ClearCache(string affiliateApplication);

       public static Hashtable Read(string affiliateApplication);

       public static int ReadInt32(string affiliateApplication, string valueName);

       public static string ReadString(string affiliateApplication, string valueName);

       public static void Update(string affiliateApplication, Hashtable ht);

   }

}


HINT: The Deployment Framework's Advanced sample application uses the settings API.


Within an orchestration, you can either create a variable of type SSOSettingsFileManager.SSOSettingsFileReader or directly reference the static methods.  Within a map, you may directly reference SSOSettingsFileReader from a Scripting functoid as a component from an external assembly.


Created with the Personal Edition of HelpNDoc: Free EBook and documentation generator