title: Override default connection string
body: <p>In an MVC web application I want to override connection strings based on the development machine I'm using. I can use Web.config transformations, but I also need to override connection strings in various non-web config files. I can use the <a href="http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5" rel="nofollow">SlowCheetah extension</a>, but then I will end up creating the same transformation for every project that accesses the database. This is a hassle to maintain when the project becomes bigger and has more developers.</p>
  
  <p>What I would like to do is modify the way Entity Framework or ASP.NET look for connection strings, adding a class of my own that looks for connection strings, and only implement the transformation logic once. I would hopefully use Ninject to inject it only when relevant.</p>
  
  <p>Is there such an "IConnectionStringProvider" interface I can implement and register, and automagically have ASP.NET and EF use it?</p>
  
  <p>EDIT. I have found <a href="http://williablog.net/williablog/post/2010/03/29/Override-Configuration-Manager.aspx" rel="nofollow">this</a>, but it seems real nasty. If there's no cleaner way, I'll just use multiple identical configuration translations, and maybe let the source control system duplicate them properly.</p>