Entity Framework Core maps classes to tables and LINQ to SQL. That is the whole promise, and most of the difficulty is in the two places the abstraction is thin: what SQL your query actually becomes, and what the change tracker thinks it is holding.
The sections below start with the model, move through migrations and querying, and end with performance and the cases where a micro ORM or plain SQL is the better tool. Dapper gets real space here rather than a footnote, because the honest answer to “EF Core or Dapper” is often both, in different parts of the same application.
Other databases live here too. MongoDB, Redis, Elasticsearch and PostgreSQL are all data access, and splitting them onto another page would only make them harder to find.
Getting Started
Wiring EF Core into an application for the first time, from both directions: model first and database first.
- Database First Development With EF Core Power Tools
- ASP.NET Core Web API with EF Core Code-First Approach
- Entity Framework Core – Getting Started
- ASP.NET Core Web API with EF Core DB-First Approach
- ASP.NET Core Web API – Creating MySQL Database
- Getting Started with ASP.NET Core and MongoDB
Modelling and Relationships
Turning classes into a schema, which is where most of the decisions you cannot easily undo get made.
- Entity Framework Core Relationships – Convention, Data Annotations and Fluent API
- Why Do We Use the Virtual Keyword for Class Properties in EF Core?
- Configuring Nonrelational Properties in EF Core
- Should We Use Records With EF Core as Model Classes?
- How to Add Unique Constraints to a Property in EF Core Code-First
- How and When to Use TPC Inheritance Mapping in EF Core
- How to Split an Entity Into Multiple Tables in EF Core
- How to Store JSON in an Entity Field With EF Core
- Improve Entity Framework Core Performance with Complex Types
Migrations
Changing a schema that already has data in it.
- Migrations and Seed Data
- Dapper Migrations with FluentMigrator and ASP.NET Core
- How to Revert a Migration in EF Core
- How to Solve the Command or File Was Not Found EF Core Error
- How to Use Entity Framework Core Migrations in Production
Querying and Loading
Reading and writing, and seeing the SQL that comes out before it surprises you in production.
- Filtering Results Using Filtered Include Method in EF Core
- Global Query Filters in Entity Framework Core
- Single and Split Queries in Entity Framework Core
- Lazy Loading and Eager Loading in Entity Framework Core
- Modifying Data with Entity Famework Core
- Database Queries in Entity Framework Core
- Fast Inserts With Entity Framework (EF Core)
- How to Show the Generated SQL Query in EF Core
- How to Use Bulk Updates in Entity Framework Core
DbContext, Interceptors and Lifetime
The object that holds the connection and the change tracker, and the trouble it causes when its lifetime is wrong.
- Dynamically Switching DbContext at Runtime Using Entity Framework Core
- How to Properly Set Connection Strings
- How to Read Connection Strings
- How to Mock EF Core DbContext
- How to Inject a DbContext Instance Into an IHostedService
- Using EF Core Interceptors
- Using Multiple Databases in ASP.NET Core via Entity Framework Core
Dapper and Raw SQL
When you want the query you wrote rather than the query an ORM composed.
- Prevent SQL Injection With EF Core, Dapper, and ADO.NET
- EntityFramework Core vs Dapper
- How to Insert and Return Inserted Identity With Dapper
- How to Pass Arguments for Output Parameters in Stored Procedures With Dapper
- How to Execute Stored Procedures With EF Core 7
Other Databases and Stores
Everything that is not a relational database with EF Core in front of it.
- Querying MongoDB With ObjectId
- Elasticsearch
- Easy Web Application Caching With Redis
- Introduction to gRPC in ASP.NET Core With MongoDB
- How to Connect a SQLite Database to EF Core
- Join MongoDB Collections With .NET and Aggregation Pipeline
- How to Configure PostgreSQL in Entity Framework Core
- Using MariaDB With ASP.NET Core Web API
Testing and Best Practices
Proving the data layer works without a production database, and the habits that keep it fast.
- Entity Framework Core Best Practices
- Testing Database Connectivity with EF Core
- Testing Repository Pattern Using Entity Framework
- How to Migrate the IdentityServer4 Configuration to the Database with EntityFramework Core
Where to Go Next
The application around the data layer:
Turn on SQL logging in development and leave it on. Nearly every EF Core performance surprise is visible the first time you read the query it generated.
