title: Entity Framework: DbContext and setting the ProviderName
body: <p>When you derive from DbContext and use the parameter-less constructor it will load a connection string from web.config. You also have the option of explicitly specifying the connectionString using one of the other DbContext constructors.</p>
  
  <p>My particular situation dictates that the connection string CANNOT be specified in the web.config, as the location of the server/username and password are determined at runtime. Easy fix right? Just use the above mentioned constructor to specify the connection string? Wrong.</p>
  
  <p>The problem is that when you specify the connection string using said constructor, it still attempts to use the default provider, so if you're using one or more non standard providers, as I am, it will not work.</p>
  
  <p>I'm sure I can change the default provider in the web.config, but I want to use multiple providers so this will not do.</p>
  
  <p>The only possible way around this that I can see is to use ObjectContext instead of DbContext, which seems to allow you to specify the provider along with the database connection string.</p>
  
  <p>Is there any other way to do it? Is my workaround fairly reasonable?</p>
  
  <p>I believe I can also create a DbContext from an ObjectContext instance.</p>