samedi 1 août 2015

SlowCheetah app.config transforms on multiple connection strings

I would like to be have multiple DB connection strings in my app.config file with the same server name. I am using SlowCheetah to perform transforms based on different configurations. Here is what I currently have, which works fine.

app.config contains:

<connectionStrings>
<add name="Catalog1String" connectionString="TO BE REPLACED" providerName="System.Data.SqlClient" />    
<add name="Catalog2String" connectionString="TO BE REPLACED" providerName="System.Data.SqlClient" />
</connectionStrings>

app.test-env.config contains:

<add name="Catalog1String" connectionString="Database=catalog1;Server=TestDbServer;Integrated Security=SSPI;Connection Timeout=60" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
<add name="Catalog2String" connectionString="Database=catalog2;Server=TestDbServer;Integrated Security=SSPI;Connection Timeout=60" xdt:Transform="Replace" xdt:Locator="Match(name)"/>

This works fine, but when I have a large number of these catalogs all with the same server name, I have to change all of them. Not a big deal but I am wondering if there is a way to simplify it such that TestDbServer (and potentially connection timeout, etc) is a key somewhere in app.config.

Does anyone have an idea?

Aucun commentaire:

Enregistrer un commentaire