home/roleplay/domain-driven-design-event-csharp-instructions

Domain Driven Design Event Csharp.instructions

GPTClaudeGemini··1,261 copies·updated 2026-07-14
domain-driven-design-event-csharp-instructions.prompt
---
applyTo: '**/*.{Domain,Application,Infrastructure}/**/*.cs'
description: Implementation guide for Domain Events using the Accumulation pattern in C# DDD applications, where events are collected in aggregates and published by infrastructure components.
---

# Domain Events - Accumulation Pattern (C#)

## Purpose
Enable clean domain models by accumulating events within aggregates and delegating publishing to infrastructure components.

## Rules and Guidelines
- ✅ **DO**: Collect events in aggregates, publish via infrastructure after persistence
- ✅ **DO**: Ensure transactional consistency between state changes and events
- ✅ **DO**: Clear events after successful publishing
- ❌ **DON'T**: Publish events before persistence
- ❌ **DON'T**: Let domain models depend on infrastructure

## SharedKernel Components
Place these interfaces and base types in SharedKernel:

fill the variables

This prompt has 1 variable. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{Domain,Application,Infrastructure}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo SebastienDegodez/copilot-instructions (Apache-2.0). A "Domain Driven Design Event Csharp.instructions" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

SebastienDegodez/copilot-instructions · Apache-2.0