title: Asp.Net Core Entity Framework in memory - no provider
body: <p>I'm trying to follow the sample in the Asp.Net Core documentation for adding a View component.  The component uses an in memory data store.  But I can't get the in memory working. I don't understand how to comply with the instructions in the error message.  What am I missing?
  This is the error:</p>
  
  <pre><code>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&lt;TContext&gt; object in its constructor and passes it to the base constructor for DbContext.
  </code></pre>
  
  <p>Which happens in this code in the lines for context.add(new ToDoItem):</p>
  
  <pre><code>namespace ViewComponentSample.Models
  {
  public class SeedData
  {
      public static void Initialize(IServiceProvider serviceProvider)
      {
          var context = serviceProvider.GetService&lt;ToDoContext&gt;();
  
          if (context.Database == null)
          {
              throw new Exception("DB is null");
          }
  
          for (int i = 0; i &lt; 9; i++)
          {
              context.Add(new TodoItem()
              {
                  IsDone = i % 3 == 0,
                  Name = "Task " + (i + 1),
                  Priority = i % 5 + 1
              });
          }
          context.SaveChanges();
      }
  
  }
  }
  </code></pre>
  
  <p>I have these dependencies in my project.json:</p>
  
  <pre><code>"dependencies": {
  "Microsoft.AspNetCore.Diagnostics": "1.0.0",
  "Microsoft.AspNetCore.Razor.Tools": {
    "version": "1.0.0-preview2-final",
    "type": "build"
  },
  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
  "Microsoft.AspNetCore.StaticFiles": "1.0.0",
  "Microsoft.EntityFrameworkCore": "1.0.1",
  "Microsoft.EntityFrameworkCore.InMemory": "1.0.1",
  "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
  "Microsoft.Extensions.Configuration.Json": "1.0.0",
  "Microsoft.Extensions.Logging": "1.0.0",
  "Microsoft.Extensions.Logging.Console": "1.0.0",
  "Microsoft.Extensions.Logging.Debug": "1.0.0",
  "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
  "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
  "BundlerMinifier.Core": "2.2.281",
  "Microsoft.AspNetCore.Mvc": "1.0.1",
  "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
  "Microsoft.NETCore.App": "1.0.0",
  "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0",
  "Microsoft.Extensions.DependencyInjection": "1.0.0",
  "Microsoft.AspNet.Routing": "1.0.0-rc1-final"
  </code></pre>
  
  <p>},</p>
  
  <p>This is in my Startup.cs ConfigureServices:</p>
  
  <pre><code>  services.AddEntityFrameworkInMemoryDatabase().AddDbContext&lt;ToDoContext&gt;(optionsAction =&gt; optionsAction.UseInMemoryDatabase());
  </code></pre>
  
  <p>This is the Model:</p>
  
  <pre><code>using Microsoft.EntityFrameworkCore;
  
  namespace ViewComponentSample.Models
  {
  public class ToDoContext : DbContext
  {
      public DbSet&lt;TodoItem&gt; ToDo { get; set; }
  }
  }
  </code></pre>