Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Csharp Efcore?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-csharp-efcore)
---
description: Write fast, migration-safe Entity Framework Core code with tracking control, indexes, and split queries
profile: standard
tags: csharp, dotnet, database, orm
---
# C# EF Core
Use when authoring `DbContext`, LINQ queries, or schema migrations with Entity Framework Core.
## Query performance
- Add `.AsNoTracking()` (or set query-level default on read-only contexts) for read queries so EF avoids change-tracker overhead.
- Project directly with `.Select(...)` into DTOs instead of materializing full entities and mapping in memory.
- Use `.AsSplitQuery()` when loading multiple collection `Include(...)` branches to avoid Cartesian row explosion.
## Migrations and concurrency
- Never share a single scoped `DbContext` concurrently across parallel `Task.WhenAll` queries; use `IDbContextFactory<T>` for concurrent work.
- Always generate SQL scripts (`dotnet ef migrations script --idempotent`) and review column drops/rebuilds before running in production.
- Configure explicit concurrency tokens (`IsRowVersion` / `IsConcurrencyToken`) on inventory or balance updates.
## Verify
Inspect generated SQL via `.ToQueryString()` or EF logging, and run integration tests against a real database/Testcontainer.