Cortex Mediator for CQRS
# Cortex Mediator Demo API
This is a demonstration project showcasing the implementation of the Cortex Mediator pattern in a .NET API application. The project serves as a practical example of using Cortex Mediator as an alternative to MediatR for implementing the mediator pattern in .NET applications.
## Key Features and Technologies
- Built with .NET 9.0
- Implements CQRS (Command Query Responsibility Segregation) using Cortex Mediator
- Integrates Serilog for comprehensive logging
- Features cross-cutting concerns through Pipeline Behaviors
- Implements Notification Pattern for event handling
## Core Components
1. **Command and Query Handling**
- Book Purchase functionality through commands
- Book retrieval by ID through queries
2. **Pipeline Behaviors**
- Logging behavior for tracking all commands and queries
- Notification behavior for handling specific command events
3. **API Endpoints**
- GET endpoint for retrieving books by ID
- POST endpoint for creating new book entries
## Technical Benefits
- Clean separation of concerns
- Enhanced maintainability through single-responsibility components
- Reusable pipeline behaviors
- Flexible architecture allowing easy modification
- Testable components that can be verified in isolation
## Testing Capabilities
The project includes HTTP request tests and comprehensive logging features, making it easy to verify functionality and track system behavior. Logs are stored in a dedicated folder with daily rolling intervals.
This implementation demonstrates a modern approach to building scalable and maintainable .NET APIs using the Cortex Mediator pattern, making it an excellent reference for similar projects.
Files you can download: