What problem does it solve?
Prevents common Entity Framework Core mistakes that cause performance regressions, concurrency conflicts, incorrect migrations, and lifetime-related runtime bugs by prescribing clear, production-ready patterns for DbContext usage, querying, transactions, and migrations.
Core Features & Use Cases
- DbContext lifetime guidance: Enforce Scoped registration, avoid injecting DbContext into singletons, and recommend IDbContextFactory for background services.
- Query performance: Encourage AsNoTracking for read-only queries, projection via Select to avoid loading full entities, and strategies to prevent N+1 problems.
- Migration & change management: Require migration files in version control, discourage editing applied migrations, use descriptive names, and prefer HasData for seeding.
- Transactions and concurrency: Recommend appropriate transaction patterns, single SaveChangesAsync per unit of work, and optimistic concurrency controls with clear handling strategies.
Quick Start
Request an audit of your .NET project for Microsoft.EntityFrameworkCore usage and generate actionable fixes for DbContext lifetime, AsNoTracking/projection, migration naming, transaction scope, and concurrency handling.