optimizing-ef-core-queries
FeaturedOptimize Entity Framework Core queries by fixing N+1 problems, choosing correct tracking modes, using compiled queries, and avoiding common performance traps. Use when EF Core queries are slow, generating excessive SQL, or causing high database load.
Install
Quality Score: 94/100
Skill Content
Details
- Author
- managedcode
- Repository
- managedcode/dotnet-skills
- Created
- 4 months ago
- Last Updated
- 2 days ago
- Language
- C#
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
entity-framework-core
Design, tune, or review EF Core data access with proper modeling, migrations, query translation, performance, and lifetime management for modern .NET applications. USE FOR: DbContext, migrations, model configuration, EF queries, tracking, loading, performance, transactions, and EF6 migration decisions. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.
ef-core-query-review
Review EF Core LINQ queries for N+1, cartesian explosion, tracking overhead, client-side evaluation, and over-fetching. Use when writing or reviewing any code that queries a DbContext.
n-plus-one-hunter
Find and fix N+1 queries and related ORM query anti-patterns — the loop that quietly fires one database query per row. Reviews application code for N+1s, nested N+1s, count/exists-in-a-loop, cartesian eager-load blowups, over-fetching, and missing foreign-key indexes, then rewrites them with the correct eager-load strategy and shows the query-count before/after. Use whenever writing or reviewing code that loads a collection and touches an association, a serializer or API response, a GraphQL resolver, a view template, or a background job — in ActiveRecord/Rails, the Django ORM, Prisma, SQLAlchemy, Sequelize, TypeORM, Ecto, or raw query code — and especially before merging an endpoint that renders a list.