dotnet-efcore-patterns

Apply tactical Entity Framework Core patterns for .NET data access.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-efcore-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-efcore-patterns
Source: https://github.com/rudironsoni/dotnet-agent-harness/tree/main/.rulesync/skills/dotnet-efcore-patterns
Command: npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-efcore-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses common challenges and best practices when working with Entity Framework Core in .NET applications, ensuring efficient and robust data access.

Core Features & Use Cases

  • DbContext Management: Understand optimal lifetimes and registration for various application types.
  • Query Optimization: Learn to use AsNoTracking and AsSplitQuery to improve performance.
  • Migrations & Interceptors: Streamline database schema evolution and implement cross-cutting concerns like auditing.
  • Use Case: Optimize a read-heavy API endpoint by ensuring all queries use AsNoTracking and configuring DbContextFactory for background services.

Quick Start

Configure your DbContext to use AddDbContextFactory for background services.

Frequently Asked Questions about dotnet-efcore-patterns

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

FAQPage Schema
How do I optimize read-heavy EF Core queries in .NET?

Optimize EF Core queries by applying AsNoTracking to skip change tracking overhead and using AsSplitQuery to prevent cartesian explosion. This Skill provides tactical patterns to improve data access performance for read-heavy endpoints.

What is the best way to manage DbContext lifecycle for background services?

Use AddDbContextFactory to manage DbContext lifecycle for background services. This Skill details optimal DbContext lifetimes and registration patterns to ensure robust data access across various application types.

Does this EF Core patterns Skill apply to PostgreSQL and SQLite providers?

Yes, these EF Core patterns apply to EF Core 8+ and common database providers including SQL Server, PostgreSQL, and SQLite. You can implement query optimization and connection resiliency across these systems.

How do I handle database schema migrations and auditing with EF Core?

Handle schema migrations and auditing by utilizing EF Core migration workflows and implementing interceptors. This Skill covers streamlining database schema evolution and applying cross-cutting concerns like auditing.

When should I use compiled queries in EF Core?

Use compiled queries in EF Core to boost performance for high-frequency, repetitive data access operations. This Skill outlines when to apply compiled queries and connection resiliency for robust application performance.