efcore-patterns

Define EF Core patterns for multi-project .NET solutions with NoTracking and query splitting.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/luongnguyenminhan/EmployeeDemoCS --skill efcore-patterns-luongnguyenminhan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: efcore-patterns
Source: https://github.com/luongnguyenminhan/EmployeeDemoCS/tree/main/.github/skills/efcore-patterns
Command: npx skills add https://github.com/luongnguyenminhan/EmployeeDemoCS --skill efcore-patterns-luongnguyenminhan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

EF Core patterns address how to maximize data access performance, maintain clean migrations, and enforce safe change-tracking practices across multi-project solutions, reducing boilerplate and deployment risk.

Core Features & Use Cases

  • NoTracking by default to improve read performance, with explicit tracking required for updates.
  • Never edit migrations manually: rely on EF Core CLI commands to manage migrations and avoid direct edits.
  • Dedicated Migration Service with Aspire: separate migrations and seeding from app startup to ensure stable deployments.
  • ExecutionStrategy for transient failures: use CreateExecutionStrategy for robust retry logic around database operations.
  • Bulk operations with ExecuteUpdate/ExecuteDelete: perform updates and deletes in SQL without loading entities.
  • Query splitting for navigation properties: configure global split behavior to avoid cartesian explosion and improve load performance.
  • Testing guidance: use InMemory for unit tests and containerized databases for integration tests.

Quick Start

Configure your DbContext with NoTracking by default, set up a dedicated migration service, enable query splitting, and follow migration CLI guidelines to keep migrations consistent.

Frequently Asked Questions about efcore-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure EF Core to use NoTracking by default for better read performance?

EF Core NoTracking by default improves read performance by disabling change tracking for queries. You must explicitly enable tracking when performing updates to ensure only modified entities are tracked.

What is the best way to manage EF Core migrations in a multi-project .NET solution?

Use a dedicated Migration Service to separate migrations and seeding from app startup. Never edit migrations manually; rely on EF Core CLI commands to maintain consistency and reduce deployment risk across projects.

How do I avoid cartesian explosion when loading complex navigation properties in EF Core?

Configure global query-splitting in EF Core to load complex navigation properties efficiently. This avoids cartesian explosion and improves load performance by splitting single queries into multiple SQL statements.

Can I perform bulk updates and deletes in EF Core without loading entities into memory?

Use ExecuteUpdate and ExecuteDelete in EF Core to perform bulk operations directly in SQL. This allows updates and deletes without loading entities, improving performance for large datasets.

How do I handle transient database failures in EF Core?

Use CreateExecutionStrategy in EF Core to implement robust retry logic around database operations. This handles transient failures and improves reliability for data access across multi-project solutions.

What testing approach should I use for EF Core data access patterns?

Use InMemory database for unit tests and containerized databases for integration tests. This validates EF Core patterns like NoTracking and query splitting without affecting production data.