EF Core RC2 FinaI Issue: No database provider has been configured for this DbContext
<p>After replacing EF Core rc 1 with EF Core rc 2 final, We are getting an invalid operation exception when calling GetService() method bellow. The goal here is to get the corresponding DbContext from any given DbSet:</p>

<pre><code>public static ObservableCollection&lt;TEntity&gt; Local&lt;TEntity&gt;(this DbSet&lt;TEntity&gt; set)
            where TEntity : class
{
            var context = set.GetService&lt;DbContext&gt;();
            ...
}
</code></pre>

<p>The exception full message:</p>

<blockquote>
  <p>No database provider has been configured for this DbContext. A
  provider can be configured by overriding the DbContext.OnConfiguring
  method or by using AddDbContext on the application service provider.
  If AddDbContext is used, then also ensure that your DbContext type
  accepts a DbContextOptions object in its constructor and passes it to
  the base constructor for DbContext.</p>
</blockquote>

<p>We effectively are setting the database provider in OnConfiguring:</p>

<pre><code>protected override void OnConfiguring(DbContextOptionsBuilder builder)
{
    base.OnConfiguring(builder);
    var connStringBuilder = new SqlConnectionStringBuilder();
    connStringBuilder.UserID = "MyUserID";
    ...         
    builder.UseSqlServer(connStringBuilder.ConnectionString);
}
</code></pre>

<p>So it seems that the issue comes from the method GetService() not resolving the correct DbContext instance for the given DbSet?.</p>