title: Inject DbContext in Asp.Net Core. Concrete type or interface?
body: <p>On an Asp.Net Core project I am injecting Entity Framework DbContext:</p>
  
  <pre><code>public MessageRepository(MyDbContext context) {
  }
  </code></pre>
  
  <p>And the configuration is:</p>
  
  <pre><code>services
    .AddEntityFramework()
    .AddSqlServer()
    .AddDbContext&lt;Context&gt;(x =&gt; x.UseSqlServer(connectionString);
  </code></pre>
  
  <p>Should I create an interface, IMyDbContext, and injecting it instead?</p>
  
  <pre><code>public class MyDbContext : DbContext, IMyDbContext { }
  
  public MessageRepository(IMyDbContext context) {
  }
  </code></pre>
  
  <p>In all ASP.NET Core examples I see the concrete type, MyDbContext, is being injected and not an interface ...</p>
  
  <p>What option should I choose?</p>