Apr 30, 2009 / .net ~ nhibernate
.NET Config for Multiple Developers

Here's a simple solution I just thought up for when you have multiple developers working on a project, and you want each to have their own connection string in Web.config (under source control).

I've seen some pretty complex approaches to this, but what about this one...


protected void Application_Start()
    //other stuff here...


Then, in web config, you'd have something like this.


    <add name="TOBIN-AB69C7A1F" connectionString="server=.\SQLEXPRESS2008;database=MdlDevelopment;Trusted_Connection=true"/>
    <add name="LIVESERVER-101" connectionString="data source=;Integrated Security=SSPI;Trusted_Connection=true"/>
    <!-- add yours here -->

In short, each developer adds a new connection string to the Web.Config. The name is his machine name. Simple huh!

You may also like...