title: How can I switch the database provider used by EF Core based on configuration?
body: <p>EF Core supports a lot of <a href="https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli" rel="nofollow noreferrer">different providers</a> and I can configure them in <code>Startup.cs</code> by specifying the provider. For example, if I want to use SQL Server, I can use:</p>
  
  <pre><code>services.AddDbContext&lt;SomeContext&gt;(options =&gt; {
      options.UseSqlServer(Configuration.GetConnectionString("SomeDatabase"));
  });
  </code></pre>
  
  <p>But the DB provider (SQL Server) seems to be hard-coded here. What I want to achieve is set the DB provider based on configuration so I can switch the DB provider based on configuration. </p>
  
  <p>Is there a way to switch provider based on config?</p>