https://github.com/iang/vs-example
A sample project showing how to use MediatR with vertical slices.
https://github.com/iang/vs-example
Last synced: 4 months ago
JSON representation
A sample project showing how to use MediatR with vertical slices.
- Host: GitHub
- URL: https://github.com/iang/vs-example
- Owner: IanG
- Created: 2024-12-31T16:35:16.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-02-05T08:25:32.000Z (5 months ago)
- Last Synced: 2025-02-05T09:29:20.513Z (5 months ago)
- Language: C#
- Homepage:
- Size: 2.04 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# VS Example
## Introduction
This is a simple project showing how a modular monolithic .NET MVC Application can be built using various layers. It also makes use of vertical slices to implement functionality The projects in the solution are as follows:## src
Contains all source code for the application.
### Application
The application layer. This project is arranged by Features/Modules. We use a CQRS-like pattern to perform:
- **Queries** - queries into the domain logic to obtain data but not change the state of the system.
- **Commands** - commands into the domain logic to mutate/change/create data.
- **Notifications** - notifications/events for when something in the domain has changed.This project depends upon the **Infrastructure** and **Domain** projects and the following nuget packages:
- [FluentResults](https://github.com/altmann/FluentResults) - for its `Result` object.
- [FluentValidation](https://docs.fluentvalidation.net/en/latest/installation.html) for validation of queries and commands
- [MediatR](https://github.com/jbogard/MediatR) - for Queries, Commannds and Notifications### Domain
Houses our entity, event and value objects. This project does not depend upon any other projects.
This project depends upon:
- [MediatR](https://github.com/jbogard/MediatR) - for Notifications
### Infrastructure
Serves as the infrastructure layer of the application. This houses:
- **Persistence** - how our entities are created, retrieved and stored
- **Logging** - how our application logs messages.plus any other technical capabilities we may need (caching, clients to external apis, telemetry). This project only depends upon our **Domain** layer.
This project makes use of:
- [Entity Framework](https://learn.microsoft.com/en-us/ef/) for domain entity persistence
- [Serilog](https://serilog.net/) for application logging.### Web
A .NET MVC application that depends upon the **Application** and **Infrastructure** projects.## test
### Unit
A project where we can implement unit tests. This project makes use of:
- [xUnit](https://xunit.net/)
- [FluentAssertions](https://fluentassertions.com/)
- [Moq](https://github.com/devlooped/moq)### Integration
This project would house Integration level tests and likely make use of:
- [TestContainers](https://testcontainers.com/) (e.g. for a throwaway database)