Exploring an ASP.NET Core MVC website
Let's walk through the parts that make up a modern ASP.NET Core MVC website.
Understanding ASP.NET Core MVC startup
Appropriately enough, we will start by exploring the MVC website's default startup configuration.
- Open the
Startup.cs
file. - Note that the
ConfigureServices
method adds an application database context using SQLite with its database connection string loaded from theappsettings.json
file for its data storage, adds ASP.NET Identity for authentication and configures it to use the application database, and adds support for MVC controllers with views as well as Razor Pages, as shown in the following code:public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite( Configuration .GetConnectionString("DefaultConnection"))); services.AddDefaultIdentity<IdentityUser>(options => options...