Setting up the database
If you're on Windows as I am, then your database server should already be up and running as a Windows service that starts automatically when your machine boots up. If you're on Mac/Linux, this may or may not be the case, so just ensure that the database server is running—the PostgreSQL website will have instructions on how to do this if necessary.
Creating a database context
EF Core will actually handle the creation of the database; we just need to tell it what kind of RDBMS we're using, and provide a connection string for its location and authentication credentials. Again, it doesn't really matter where we put the following files, but my preference is a Data
folder for anything to do with EF setup/configuration, entity models, and seed data.
The first file we'll need to create is an EF database context class:
namespace ECommerce.Data { public class EcommerceContext : IdentityDbContext<AppUser, AppRole, int> { public EcommerceContext(DbContextOptions...