title: How to Add an implementation of 'IDesignTimeDbContextFactory<DataContext>' to the project in asp.net-core-2.0
body: <p>Here are the list of packages which I have installed : <a href="https://i.stack.imgur.com/UQLme.png" rel="noreferrer">Installed Packages</a></p>
  
  <p>I am using Entityframework core 2.0. First time I have successfully created database using entity framework code first migration(add-migration and update-database command).
  Now when I update my entities and try to run migration it's giving me following error.</p>
  
  <p>Unable to create an object of type 'DataContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see <a href="https://go.microsoft.com/fwlink/?linkid=851728" rel="noreferrer">https://go.microsoft.com/fwlink/?linkid=851728</a> for additional patterns supported at design time. </p>
  
  <p>Here is my code ... </p>
  
  <p><strong>Program.cs</strong></p>
  
  <pre><code>public static void Main(string[] args)
  {
      BuildWebHost(args).Run();
  }
  
  public static IWebHost BuildWebHost(string[] args) =&gt;
      WebHost.CreateDefaultBuilder(args)
          .UseStartup&lt;Startup&gt;()
          .Build();
  </code></pre>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre><code>public Startup(IConfiguration configuration)
  {
      Configuration = configuration;
  }
  
  public IConfiguration Configuration { get; }
  
  // This method gets called by the runtime. Use this method to add services to the container.
  public void ConfigureServices(IServiceCollection services)
  {
      // Repositories
  
      services.AddMvc();
      services.AddDbContextPool&lt;DataContext&gt;(
          options =&gt; options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
          //options =&gt; options.UseSqlServer(@"Server=LAPTOP-518D8067;Database=Gyanstack;Trusted_Connection=True;MultipleActiveResultSets=true"));
  
      services.AddCors();
      services.AddScoped&lt;ISectionRepository, SectionRepository&gt;();
      services.AddScoped(typeof(IEntityBaseRepository&lt;&gt;), typeof(EntityBaseRepository&lt;&gt;));
  }
  </code></pre>
  
  <p><strong>DataContext.cs</strong></p>
  
  <pre><code>public class DataContext : DbContext
  {
      public DataContext(DbContextOptions&lt;DataContext&gt; options) 
          : base(options)
      { }
  
      public DbSet&lt;Section&gt; Section { get; set; }
      public DbSet&lt;SubSection&gt; SubSection { get; set; }
      public DbSet&lt;Article&gt; Article { get; set; }
      public DbSet&lt;Comment&gt; Comment { get; set; }
      public DbSet&lt;User&gt; User { get; set; }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          modelBuilder.AddConfiguration(new SectionMap());
          modelBuilder.AddConfiguration(new SubSectionMap());
          modelBuilder.AddConfiguration(new ArticleMap());
          modelBuilder.AddConfiguration(new CommentMap());
      }
  }
  </code></pre>