44 practical guides

EF Core Guides for .NET

Start by configuring a DbContext and connecting to PostgreSQL. Then choose a reading path for the problem you are working on. Each path moves from the basic decisions to more specific implementation and troubleshooting guides.

Start here

EF Core and PostgreSQL: Getting Started Guide

PostgreSQL is a powerful open-source database with features like JSONB, arrays, and full-text search. Here is how to set it up with EF Core using the Npgsql provider.

Read the complete guide →

Modeling

Configure relationships, value objects, keys, and database-specific column types.

  1. Configuring Entity Relationships in EF Core

    7 min read

  2. Cascade Delete in EF Core: Behaviors and Pitfalls

    7 min read

  3. Composite Primary Keys in EF Core

    6 min read

  4. Identity vs Sequence vs HiLo Key Generation in EF Core

    6 min read

  5. Value Conversions in EF Core Explained

    6 min read

  6. Mapping Enums in EF Core: Strings, Ints, and Native Postgres Enums

    6 min read

  7. Owned Types in EF Core for DDD Value Objects

    6 min read

  8. Complex Types in EF Core 8: What You Need to Know

    6 min read

  9. Table Per Hierarchy vs Table Per Type in EF Core

    8 min read

  10. Mapping JSON Columns in EF Core

    6 min read

  11. Computed Columns in EF Core

    6 min read

  12. Shadow Properties in EF Core Explained

    6 min read

  13. Modeling Hierarchical Data in EF Core

    6 min read

  14. Custom Model Conventions in EF Core

    5 min read

Querying

Understand tracking, load related data, and build paginated queries.

  1. Understanding the EF Core Change Tracker

    6 min read

  2. Find vs FirstOrDefault in EF Core

    7 min read

  3. EF Core Lazy Loading vs Eager Loading vs Explicit Loading

    6 min read

  4. AsNoTracking vs AsNoTrackingWithIdentityResolution

    7 min read

  5. Pagination in ASP.NET Core With EF Core

    6 min read

  6. Fixing "The Instance of Entity Type Cannot Be Tracked" in EF Core

    6 min read

  7. Repository Pattern in C# With Entity Framework Core

    7 min read

  8. Unit of Work Pattern With EF Core

    6 min read

Performance

Inspect generated SQL, fix expensive queries, and evaluate pooling and compiled models.

  1. EF Core Performance: Tips, Tricks, and Best Practices

    6 min read

  2. How to Log SQL Queries Generated by EF Core

    5 min read

  3. EF Core Query Performance: Avoid These Mistakes

    6 min read

  4. N+1 Query Problem in EF Core and How to Fix It

    6 min read

  5. DbContext Pooling in EF Core: When It Helps and When It Bites

    6 min read

  6. EF Core Compiled Models for Faster Startup

    7 min read

  7. EF Core vs Dapper: When to Use Each

    5 min read

Migrations

Plan schema changes, automate deployments, and prepare for rollback.

  1. EF Core Migrations Best Practices in Production

    7 min read

  2. Seeding Data in EF Core: Strategies and Best Practices

    7 min read

  3. EF Core Migration Bundles for CI/CD Deployments

    6 min read

  4. Zero-Downtime Database Migrations With EF Core

    7 min read

  5. How to Roll Back an EF Core Migration

    6 min read

  6. Fixing PendingModelChangesWarning in EF Core 9

    6 min read

Production operations

Configure database access, handle retries and concurrency, and record data changes.

  1. EF Core and PostgreSQL: Getting Started Guide

    6 min read

  2. EF Core DbContext: Configuration and Best Practices

    6 min read

  3. How to Use EF Core With Multiple Databases

    6 min read

  4. EF Core Connection Resiliency and Retry Logic

    5 min read

  5. Fixing "Cannot Write DateTime with Kind=Local" With Npgsql

    6 min read

  6. Optimistic Concurrency With Postgres xmin in EF Core

    7 min read

  7. PostgreSQL Locking for .NET Developers: FOR UPDATE, SKIP LOCKED, and Advisory Locks

    9 min read

  8. Audit Logging With EF Core Interceptors

    7 min read

  9. Temporal Tables in EF Core for Data Auditing

    6 min read