Search code examples
c#.netumbracoconnection-string

Using Different Connection Strings in Local Development


I have an Umbraco project with multiple developers working on it, each developer has a different connection string for their local database. The process currently is that we change the connection string in the web config locally which works until the next git push/gitpull when it's overrided and we have to manually revert the connection string.

I've seen a plugin called SlowCheetah that allows local web config trasnforms but have had very mixed results with it so am ideally looking for something more robust.

How is this issue normally solved?


Solution

  • I've found what I think is a fairly simple workaround for this using the configSource attribute. We're now holding the connection strings in an external file connections.txt which is simply ignored in git and referenced in the web config file.

    In the web config:

    <connectionStrings configSource="connections.config"/>
    

    And the text file:

    <connectionStrings>
        <add name="CONNECTIONNAME" connectionString="CONNECTIONSTRING" providerName="PROVIDERNAME" />
    </connectionStrings>