BRE Policy - Where to Store Connection Strings for Db Facts

174 views Asked by At

Using BizTalk 2016 FP3 CU5.

I have a BRE Rule that accepts 4 typed xml documents and a single data connection. I've setup an orchestration to execute it using the call rules shape.

I'm using the BizTalk Deployment Framework (BTDF) for deployment and this does a good job of deploying the BRE policies to. My problem is, within the exported xml for the policy (named NotificationService.xml) there's a hard-coded reference to a database used in a rule - as follows:

 <datarow ref="db_32" server="SDEIDBTI04\CrossRef" dataset="CrossRef" table="Lookups"

This references my dev vm but as the solution is promoted through test and into production, the server name needs to change accordingly.

My current solution to this problem is to use the BTDF's ability to pre-process xml files and substitute with value from the EnvironmentSettings excel file, taken from the SSO. So, I've created a "NotificationService.Dynamic.xml" in which I've changed the previous line to:

<!-- ifdef ${_xml_preprocess} -->
  <datarow ref="db_32" server="${Common.Components.CrossRefDbServer}\CrossRef" dataset="CrossRef" table="Lookups" instances="16" selectivity="1" isdataconnection="true" instance="0" />
  <!-- endif -->

(*there's a good reason I've had to keep the ifdefs!)

In my deployment.btdfproj file, I have added the following to ensure the pre-processed policy is the one that gets deployed:

<FilesToXmlPreprocess Include="NotificationService.Dynamic.xml" 
Condition="'$(Configuration)' == 'Server'">
  <LocationPath>..\</LocationPath>
  <OutputFilename>NotificationService.Dynamic_Processed.xml</OutputFilename>
</FilesToXmlPreprocess>

<FilesToXmlPreprocess Include="NotificationService.Dynamic.xml" Condition="'$(Configuration)' != 'Server'">
  <LocationPath>..\NotificationService\NotificationService.BRE</LocationPath>
  <OutputFilename>NotificationService.Dynamic_Processed.xml</OutputFilename>
</FilesToXmlPreprocess>

<RulePolicies Include="NotificationService.Dynamic_Processed.xml">
  <LocationPath>..\NotificationService\NotificationService.BRE</LocationPath>
</RulePolicies>

This is working but I can't help but think I've over complicated the solution. Each time I export a new version of the policy I now have to go through the hassle of of creating a NotificationService.Dynamic.xml file from the exported NotificationService.xml file. How do people solve the same problem when not using the BTDF?

If it turns out that I've followed the best path then hopefully this question will be of assistance to other in future - I could find no answers from google!

1

There are 1 answers

0
r3verse On BEST ANSWER

I'd make a static method where you create all the logic getting your lookup value.

So in this method you'd get the SSO CrossRefDbServer setting using the SSOSettingsFileReader.dll, then do some c# code to call your lookuptable and return the value.

You can then call this method in your BRE if you set the registry setting StaticSupport to 1.