efcore-patterns

Configure Entity Framework Core DbContext with NoTracking by default.

57|7|Updated Aug 6, 2025
One-click install
npx skills add https://github.com/seiggy/lucia-dotnet --skill efcore-patterns-seiggy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: efcore-patterns
Source: https://github.com/seiggy/lucia-dotnet/tree/main/.github/skills/efcore-patterns
Command: npx skills add https://github.com/seiggy/lucia-dotnet --skill efcore-patterns-seiggy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides essential patterns and best practices for using Entity Framework Core effectively, ensuring performance, maintainability, and robustness in your .NET applications.

Core Features & Use Cases

  • Performance Optimization: Learn to use NoTracking and ExecuteUpdate/ExecuteDelete for faster queries.
  • Migration Management: Understand safe and reliable ways to manage database schema changes.
  • Robustness: Implement strategies like ExecutionStrategy to handle transient database failures.
  • Use Case: When setting up a new .NET project, use this Skill to configure your DbContext with NoTracking by default and implement a dedicated migration service for safe deployments.

Quick Start

Use the efcore-patterns skill to configure your DbContext with NoTracking by default.

Frequently Asked Questions about efcore-patterns

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

FAQPage Schema
How do I optimize EF Core query performance in .NET applications?

Optimize EF Core query performance by using NoTracking by default for read-only operations, applying query splitting, and leveraging ExecuteUpdate or ExecuteDelete for targeted bulk modifications to reduce tracking overhead and database roundtrips.

What is the best way to manage database migrations in Entity Framework Core?

Manage EF Core migrations safely by implementing a dedicated migration service for deployments, ensuring reliable database schema evolution without manual script execution errors during production releases.

How do I handle transient database failures with Entity Framework Core?

Handle transient database failures in Entity Framework Core by implementing an ExecutionStrategy, which automatically retries operations that fail due to temporary connection issues, ensuring robust data access layers.

Can I configure NoTracking as the default behavior for my EF Core DbContext?

Yes, you can configure your EF Core DbContext to use NoTracking by default, which significantly improves query performance by skipping change tracking when retrieving entities that are not meant to be updated.

When should I use ExecuteUpdate and ExecuteDelete instead of standard EF Core queries?

Use ExecuteUpdate and ExecuteDelete in EF Core when you need to perform bulk updates or deletions directly against the database, bypassing change tracking to achieve faster performance for large-scale data modifications.