title: Determine at runtime which db provider is being used, with EF Core
body: <p>In our ASP.NET Core and EF Core system, we use different databases for different parts of the system. I need to be able to tell, at runtime, which db provider is being used, because some stuff needs to take this into account.</p>
  
  <p>During startup, there is this for SQL Server:</p>
  
  <pre><code>  services.AddDbContext&lt;MyContext&gt;(
      options =&gt; options.UseSqlServer(config.GetConnectionString("DefaultConnection"))
    );
  </code></pre>
  
  <p>or this for SQLite:</p>
  
  <pre><code>  services.AddDbContext&lt;MyContext&gt;(
      options =&gt; options.UseSqlite(config.GetConnectionString("DefaultConnection"))
    );
  </code></pre>
  
  <p><em>The point being that the knowledge of which database is being used, is contained within the system, somewhere.</em></p>
  
  <p>At some arbitrary point in the system, how can I determine which database I'm using? I have access to the <code>MyContext</code>. Is there something in there that can reveal this info?</p>