Last post Apr 24, 2018 03:16 AM by Nan Yu
Apr 23, 2018 11:14 PM|rkrex|LINK
I was just wondering if I could get some help on understanding what this block of code does, specifically : IdentityDbContext<ApplicationUser> . Thanks !
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
: base("DefaultConnection", throwIfV1Schema:
Apr 24, 2018 03:16 AM|Nan Yu|LINK
The ASP.NET MVC 5 templates with Authentication enabled will create a project that contains a class named ApplicationDbContext.
This is the Entity Framework context used to manage interaction between our application and the database where our Account data is persisted (which may, or may not be the same database that will be used by the rest of our application). Important to
note that this class inherits not from DBContext (as is the usual case with EF), but instead from IdentityDbContext. In other words, ApplicationDbContext inherits
from a pre-defined DB context defined as part of Microsoft.AspNet.Identity.EntityFramework which contains
the “Code-First” base classes for the Identity system.
Please refer to below links for more details :
Configuring Db Connection and Code-First Migration for Identity Accounts in ASP.NET MVC 5
Getting Started with Entity Framework 6 Code First using MVC 5
Introduction to ASP.NET Identity