A step-by-step walkthrough of replacing in-memory persistence with a PostgreSQL database in an ASP.NET Core application using Entity Framework Core. Covers creating entities and DbContext, configuring EF with the fluent API and IEntityTypeConfiguration, setting up DI registration, running EF migrations (including a .NET Standard workaround), and auto-applying migrations on startup. Also explores optimistic concurrency using PostgreSQL's xmin column as a concurrency token, with notes on shadow properties and change tracker behavior during updates.
Table of contents
Intro #The data access project #Creating the entities and DbContext #Adapting the business layer #Configuring EF in the web application #Migrations #Ensuring database up to date #Optimistic concurrency #Outro #22 Impressions