Pattern D: 親子一体 CRUD(マスター明細)

Create or update an aggregate root with child entities in one EF Core transaction.

1|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/ke-kishimoto/asp-todos --skill pattern-d-crud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Pattern D: 親子一体 CRUD(マスター明細)
Source: https://github.com/ke-kishimoto/asp-todos/tree/main/.github/skills/pattern-d-master-detail
Command: npx skills add https://github.com/ke-kishimoto/asp-todos --skill pattern-d-crud

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pattern D enables building and editing a parent entity and its multiple child items in a single screen and a single transaction, ensuring the aggregate root stays consistent.

Core Features & Use Cases

  • Atomic master-detail CRUD: Create, update, and delete a parent with a variable number of child rows in one operation.
  • Domain-driven design alignment: Model the parent as an aggregate root that encapsulates child items and enforce invariants within the domain.
  • Use Case: Order forms or invoices where an Order (header) contains multiple OrderLine items, saved together atomically.

Quick Start

Initialize a new master-detail workflow by creating an Order with multiple OrderLine items and save it in a single transaction.

Frequently Asked Questions about Pattern D: 親子一体 CRUD(マスター明細)

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

FAQPage Schema
How do I save a parent entity and its multiple child items in a single transaction using EF Core?

To save a parent entity and multiple child items in one transaction with EF Core, you model the parent as an aggregate root that encapsulates a collection of child entities, ensuring atomic CRUD operations and consistency across the aggregate.

What is the best way to handle master-detail CRUD operations in domain-driven design?

The best way to handle master-detail CRUD in domain-driven design is to model the parent as an aggregate root, encapsulate the child entities, and enforce invariants within the domain while persisting the entire aggregate atomically through a repository.

When do I need to use an aggregate root for parent-child data persistence?

You need an aggregate root for parent-child data persistence when a single screen operation must create or update a header with a variable number of line items, requiring strict consistency across the entire aggregate during the transaction.

Can I update a variable number of child rows atomically with a parent header in EF Core?

Yes, you can update a variable number of child rows atomically with a parent header in EF Core by using command handlers to manage create, update, and delete operations for the aggregate root and persisting them together in one transaction.

How does command handler based persistence work for master-detail aggregates?

Command handler based persistence for master-detail aggregates works by receiving create, update, or delete commands, applying them to the aggregate root and its child entities, and then using a repository to commit the entire aggregate in a single EF Core transaction.