title: Using Entity Framework with a Mirrored Database, and minimizing work duplication
body: <p><strong>Environment:</strong><br>
  ASP.Net 4.0<br>
  MVC 4<br>
  SQL Server 2005<br>
  Visual Studio 2010<br></p>
  
  <p><strong>Issue:</strong><br>
  We have an SQL 2005 Database which is transactionally replicated to a separate server because a number of large business queries are run against the data and slow the system down. The secondary server is used for all reports (read only), while the primary server is used for day-to-day business. Our legacy code uses stored procedures to access the database and it was relatively easy to maintain different connection strings and have all reports use the report server connection string. We've recently started writing all of our newer code using Entity Framework for data access, however, and I'm at a loss for how to deal with the two different servers. </p>
  
  <p>A simple solution would be, perhaps, to simply maintain two .edmx and point all of the reports to the second .edmx. I strongly dislike this method, however, as it requires that the developers maintain the two different files. </p>
  
  <p>Has anyone else encountered this scenario and devised a more appropriate solution? Is there any way I can use the same .edmx for both servers (since they are identical) but somehow specify at the Controller or Action level which connection string to use?</p>
  
  <p>Ideally I am looking for a solution that does not require manual SSDL writing. I'd like to continue to use the designer and "Update Model from Database" features.</p>
  
  <p>Thank you for your time,
  Mirzero</p>