Soft Delete Example
Overview
Complete Flow Architecture
DELETE Request → Controller → Service → PreBus Plugins → Command Handler → RESTClient → External System
↓
Response ← Controller ← Service ← Command Handler ← RESTClient ← External SystemDetailed Flow Breakdown
1. DELETE Request
↓
2. Controller (API Entry Point)
↓
3. Service Layer (Business Orchestration)
↓
4. PreBus Processing (Validation Pipeline)
├── SoftDeleteShippingSequence (Plugin Registration)
├── SoftDeleteShippingDataPacket (Validation Context)
└── IsValidShippingForSoftDelete Plugin (Business Rules)
↓
5. Command Handler (RESTClient Integration)
├── Internal DTO → Request DTO Mapping
├── RESTClient Call to External System
└── Response DTO Processing
↓
6. Event Publishing (Asynchronous Processing)
↓
7. Subscribers (Side Effects)Step-by-Step Implementation
1. API Controller - The Entry Point
2. Service Layer - Business Orchestration
2.1. PreBus Business Rule Sequence - Validation Pipeline
2.2. PreBus Data Packet - Validation Context
2.3. PreBus Validation Plugin - Business Rules
3. Command Handler - RESTClient Integration
4. Domain Model - Business Logic
5. NServiceBus Handler - Message Processing
6. Event Publishing - Asynchronous Processing
7. Event Subscribers - Side Effects
Data Transfer Objects (DTOs)
Input DTO: SoftDeleteShippingDto
SoftDeleteShippingDtoCommand: SoftDeleteShippingCommand
SoftDeleteShippingCommandKey Differences from Hard Delete
Soft Delete vs Hard Delete Characteristics
Aspect
Soft Delete
Hard Delete
Soft Delete-Specific Features
Soft Delete Pattern Benefits
Flow Summary
Synchronous Flow (Immediate Response)
Asynchronous Flow (Event Processing)
Query Filtering for Soft Deleted Items
Standard Query Filtering
Include Soft Deleted Items (Admin Queries)
Key Benefits
Last updated