https://github.com/hemmatiali/ordermanagementsystem
A simple .NET 8 implementation of the Pub/Sub design pattern using MediatR, following Clean Architecture and CQRS principles. Demonstrates event publishing with one event and three consumers. Includes solid software practices such as validation, error handling, and a generic repository pattern.
https://github.com/hemmatiali/ordermanagementsystem
api-rest clean-architecture cqrs csharp dotnet event-driven events mediatr publisher-subscriber-pattern solid
Last synced: 2 months ago
JSON representation
A simple .NET 8 implementation of the Pub/Sub design pattern using MediatR, following Clean Architecture and CQRS principles. Demonstrates event publishing with one event and three consumers. Includes solid software practices such as validation, error handling, and a generic repository pattern.
- Host: GitHub
- URL: https://github.com/hemmatiali/ordermanagementsystem
- Owner: Hemmatiali
- Created: 2025-02-27T10:39:32.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-12T12:33:51.000Z (over 1 year ago)
- Last Synced: 2025-04-12T16:13:13.237Z (over 1 year ago)
- Topics: api-rest, clean-architecture, cqrs, csharp, dotnet, event-driven, events, mediatr, publisher-subscriber-pattern, solid
- Language: C#
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 📨 Simple Pub/Sub Event Pattern with MediatR (.NET 8, Clean Architecture)
This project is a **simple implementation of the Pub/Sub design pattern using MediatR** in a clean and modular way. It demonstrates how to raise and handle domain events within a **Clean Architecture** structure using **CQRS** and **.NET 8**.
---
## 🛠 Tech Stack
- **.NET 8**
- **Entity Framework Core**
- **SQL Server**
- **MediatR**
- **Clean Architecture** (Domain, Application, Infrastructure, Presentation)
- **CQRS Pattern**
---
## 📚 Project Structure
This solution follows the Clean Architecture principles and is divided into the following layers:
- **Domain** – Contains core entities and shared items.
- **Application** – Handles features related items, events, business logic, MediatR handlers, validators.
- **Infrastructure** – Implements generic repository and database context using EF Core.
- **Presentation (API)** – Exposes endpoints and coordinates requests.
---
## ✨ Features
- ✅ Simple **Event Publishing** using MediatR (In memory events).
- ✅ **One event** and **three separate consumers** (handlers).
- ✅ **CQRS pattern** for separation of command and query responsibilities.
- ✅ **Client-side caching** (to be integrated optionally).
- ✅ **Generic repository** pattern implementation for DB operations.
- ✅ **Proper error handling** for APIs.
- ✅ **SOLID principles**, clean code practices, and **inheritance** used across layers.
---
## 🚀 Getting Started
### Prerequisites
- .NET 8 SDK
- SQL Server
### Run the Project
```bash
git clone https://github.com/Hemmatiali/OrderManagementSystem
cd OrderManagementSystem
dotnet ef database update
dotnet run --project Presentation
' 🤝 Contributing
' Feel free to fork the repo, open issues, and submit pull requests to help improve this simple yet powerful pattern demonstration.