bulk-operations

Automate bulk updates and deletes in EF Core via translated LINQ expressions.

14.8k|3.4k|Updated Jan 23, 2014
One-click install
npx skills add https://github.com/dotnet/efcore --skill bulk-operations-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bulk-operations
Source: https://github.com/dotnet/efcore/tree/main/.agents/skills/bulk-operations
Command: npx skills add https://github.com/dotnet/efcore --skill bulk-operations-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables safe and efficient bulk updates and deletes in EF Core by translating LINQ patterns into optimized SQL, avoiding loading large datasets into memory.

Core Features & Use Cases

  • Supports EF Core ExecuteUpdate and ExecuteDelete semantics for bulk data modifications.
  • Improves performance by reducing round-trips to the database during mass updates or deletions.
  • Use Case: apply a global change across thousands of rows without enumerating them in application memory.

Quick Start

Call context.Set<YourEntity>().Where(e => e.IsArchived).ExecuteUpdate() to apply bulk changes directly in the database.

Frequently Asked Questions about bulk-operations

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

FAQPage Schema
How do I perform bulk updates in EF Core without loading entities into memory?

EF Core bulk updates use ExecuteUpdate to translate LINQ expressions into optimized SQL, applying changes directly in the database without materializing in-memory entities. This avoids loading large datasets during mass modifications.

What is the best way to delete thousands of rows in EF Core efficiently?

Efficient bulk deletes in EF Core use ExecuteDelete to translate LINQ predicates into direct SQL DELETE statements. This reduces database round-trips and bypasses entity materialization for large-scale row removal.

Can I use LINQ expressions to apply bulk changes directly to the database?

Yes, LINQ expressions can be translated into optimized SQL to apply bulk changes directly to the database. This mechanism supports ExecuteUpdate and ExecuteDelete semantics for mass data modifications.

Does executing bulk operations in EF Core maintain transactional integrity?

Executing bulk operations in EF Core maintains transactional integrity during large-scale data modifications. This ensures that mass updates and deletes via translated LINQ expressions execute safely within database transactions.

Why does enumerating large datasets in application memory slow down mass updates?

Enumerating large datasets in memory slows mass updates because it requires loading every entity before applying changes. Translating LINQ to SQL executes bulk updates directly in the database, avoiding this performance bottleneck.