title: No database provider has been configured for this DbContext for get method in Asp.netCore
body: <p>I create an web api project by Asp.net core, and i added an api controller to it(by the name <code>BlogController</code>), in blog controller i have a get method <code>GetAllBlog</code> this is my controller:</p>
  
  <pre><code>[Route("api/[controller]")]
  public class BlogController : Controller
  {
      private static Logger logger = LogManager.GetCurrentClassLogger();
  
      public IContext _context { get; set; }
      public BlogController(IContext ctx)
      {
          _context = ctx;
      }
  
      [HttpGet]
      public IEnumerable&lt;Blog&gt; GetAllBlog()
      {
          return _context.Blogs.ToList();
      }
   }
  </code></pre>
  
  <p>this is my IContext and model:</p>
  
  <pre><code>public interface IContext : IDisposable
  {
      DbSet&lt;Blog&gt; Blogs { get; set; }
      DbSet&lt;Post&gt; Posts { get; set; }
      int SaveChanges();
  }
  </code></pre>
  
  <p>and context:</p>
  
  <pre><code>public class Context : DbContext, IContext
  {
      public Context(DbContextOptions&lt;Context&gt; options) : base(options)
      { }
      public virtual DbSet&lt;Blog&gt; Blogs { get; set; }
      public virtual DbSet&lt;Post&gt; Posts { get; set; }
  }
  </code></pre>
  
  <p>and model:</p>
  
  <pre><code>public class Blog
  {
      public int BlogId { get; set; }
      public string Name { get; set; }
      public string Url { get; set; }
      public DateTime? CreationDate { get; set; }
      public virtual IList&lt;Post&gt; Posts { get; set; }
  }
  </code></pre>
  
  <p>when i call <code>GetAllBlog()</code> i got this error:</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.
    what is the problem?</p>
  </blockquote>
  
  <p>UPDATE: this is the <code>configurationservice</code> method in <code>Startup</code> class:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      var connection = @"Data Source=.;Initial Catalog=RestfullServices;Integrated Security=true";
      services.AddDbContext&lt;Context&gt;(options =&gt; options.UseSqlServer(connection));
      services.AddScoped&lt;IContext&gt;(p =&gt; new Context(new DbContextOptions&lt;Context&gt;()));
      services.AddApplicationInsightsTelemetry(Configuration);
      services.AddMvc();
  }
  </code></pre>