ef-core-advanced-patterns

Implement and optimize advanced EF Core data access patterns for .NET.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/alexsandrocruz/DominusLeads --skill ef-core-advanced-patterns-alexsandrocruz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ef-core-advanced-patterns
Source: https://github.com/alexsandrocruz/DominusLeads/tree/main/backend/Sapienza.Leads/.claude/skills/ef-core-advanced-patterns
Command: npx skills add https://github.com/alexsandrocruz/DominusLeads --skill ef-core-advanced-patterns-alexsandrocruz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps .NET developers implement and optimize advanced EF Core data access patterns.

Core Features & Use Cases

  • Change Tracking Optimization: No-tracking queries, identity resolution, and bulk update strategies to reduce overhead.
  • Loading Strategies: Effective use of eager, explicit, and lazy loading, plus loading patterns to avoid N+1 queries.
  • Query Splitting & Performance: Techniques to avoid cartesian explosion with AsSplitQuery and split queries.
  • Compiled Queries: Pre-compile hot paths for faster data access.
  • Batch Operations: ExecuteUpdate and ExecuteDelete patterns for bulk data changes without loading entities.
  • PostgreSQL Features: Leverage arrays, JSONB, FTS, and range types within EF Core.

Quick Start

Run the EF Core advanced patterns sample project to observe change tracking, loading strategies, query splitting, and bulk updates in action.

Frequently Asked Questions about ef-core-advanced-patterns

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

FAQPage Schema
How do I avoid cartesian explosion in EF Core when querying related entities?

To avoid cartesian explosion in EF Core, use the AsSplitQuery method to split queries into multiple SQL statements, preventing large cartesian product result sets when loading multiple related collections. This reduces memory overhead and improves query performance.

What is the best way to perform bulk updates in EF Core without loading entities into memory?

The best way to perform bulk updates in EF Core without loading entities is using ExecuteUpdate and ExecuteDelete patterns. These batch operations directly modify database rows, bypassing the change tracker and significantly reducing memory consumption for high-volume data modifications.

How does EF Core compiled queries improve data access performance?

EF Core compiled queries improve data access performance by pre-compiling hot paths into reusable delegates. This eliminates the query translation overhead during runtime, yielding faster execution for frequently executed queries in high-performance .NET applications.

Can I use PostgreSQL JSONB and array features with EF Core?

Yes, you can use PostgreSQL JSONB, arrays, FTS, and range types with EF Core. The Npgsql provider integrates these PostgreSQL-specific features, allowing you to leverage complex data structures and full-text search directly within your EF Core data access patterns.

How do I stop N+1 query problems with EF Core loading strategies?

To stop N+1 query problems in EF Core, implement effective loading strategies like eager loading to fetch related data upfront, or use explicit loading to control when related entities are retrieved, preventing excessive database round trips in your .NET application.

When should I use no-tracking queries in EF Core for change tracking optimization?

You should use no-tracking queries in EF Core for read-only operations to reduce change tracking overhead. This optimization prevents the DbContext from storing entity snapshots, improving application performance and memory efficiency when you do not need to update the retrieved data.