June 2017
Intermediate to advanced
1083 pages
22h 12m
English
Now that we have our own DbContext and a valid Connection String, we can easily add the initial migration and create our database.
The first thing we have to do is add the EF support and our ApplicationDbContext implementation to our application startup class. Open the Startup.cs file and update the ConfigureServices method in the following way (new lines are highlighted):
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
// Add EntityFramework's Identity support.
services.AddEntityFramework();
// Add ApplicationDbContext.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]) ...Read now
Unlock full access