
Efcore Patterns
This covers the pragmatic patterns you need for EF Core in production apps. It defaults to NoTracking for read queries (with clear examples of when you need to explicitly call Update()), enforces never manually editing migration files, and sets up a dedicated migration service that runs before your main app starts. The query splitting guidance helps when you're loading multiple navigation collections and hitting cartesian explosion problems. Honestly, the NoTracking-by-default approach is opinionated but makes sense for read-heavy workloads, just be ready to explicitly mark entities for updates or use AsTracking() when you actually need change detection.
- skills.sh installs
- 1.6K
- GitHub stars
- 1.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aaronontheweb/dotnet-skills --skill efcore-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
Entity Framework Core Patterns
When to Use This Skill
Use this skill when:
- Setting up EF Core in a new project
- Optimizing query performance
- Managing database migrations
- Integrating EF Core with .NET Aspire
- Debugging change tracking issues
- Loading multiple navigation collections efficiently (query splitting)
Core Principles
- NoTracking by Default - Most queries are read-only; opt-in to tracking
- Never Edit Migrations Manually - Always use CLI commands
- Dedicated Migration Service - Separate migration execution from application startup
- ExecutionStrategy for Retries - Handle transient database failures
- Explicit Updates - When NoTracking, explicitly mark entities for update
Pattern 1: NoTracking by Default
Configure your DbContext to disable change tracking by default. This improves performance for read-heavy workloads.
Sponsors
Details
- Repository
- github.com/aaronontheweb/dotnet-skills
- Category
- .NET & C#
More from aaronontheweb/dotnet-skills
All 34- Dependency Injection Patterns703
- Database Performance700
- Dotnet Project Structure692
- Api Design690
- Type Design Performance684
- Ilspy Decompile640
- Package Management613
- Microsoft Extensions Configuration609
- Serialization596
- Crap Analysis581
- Dotnet Slopwatch580
- Testcontainers Integration Tests579
- Playwright Blazor Testing560
- Dotnet Local Tools550
- Aspire Integration Testing522
- Mjml Email Templates513
- Aspire Service Defaults497
- Aspire Configuration487
- Snapshot Testing484
- Dotnet Devcert Trust457
- Skills Index Snippets456
- Playwright Ci Caching455
- Akka Net Best Practices451
- Mailpit Integration443