Skip to content

Commit 43fb98a

Browse files
committed
Added entry
1 parent 78c2306 commit 43fb98a

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

MediatorPattern/Command/DeleteAllUsersCommandHandler.cs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
namespace MediatorPattern.Command;
55

6+
// We have to return Unit because "void" is not a valid return type
7+
// With that MediatR can have a uniform and easy API
68
public class DeleteAllUsersCommandHandler : IRequestHandler<DeleteAllUsersCommand, Unit>
79
{
810
private readonly UserRepository _userRepository;

MediatorPattern/Program.cs

+7
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@
2121
ServiceProvider CreateServiceProvider()
2222
{
2323
var collection = new ServiceCollection();
24+
// This will execute our main logic
2425
collection.AddScoped<Execution>();
26+
27+
// This comes from the MediatR package.
28+
// It looks for all commands, queries and handlers and registers
29+
// them in the container
2530
collection.AddMediatR(typeof(Program).Assembly);
31+
32+
// Our repository
2633
collection.AddScoped<UserRepository>();
2734
return collection.BuildServiceProvider();
2835
}

MediatorPattern/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Mediator Pattern - CQRS with MediatR
2+
3+
The famous mediator pattern. Used so often especially in combination with **CQRS**.
4+
5+
In this article I will show how the mediator pattern itself works, what **CQRS** is and its advantages.
6+
For that we will write a small application, which demonstrates how to use the pattern and what we gain from using it.
7+
8+
Found [here](https://steven-giesel.com/blogPost/064ca62a-b384-45da-9212-4c3840e5ba9c)

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Contains all of my examples from various blog posts. You can find a comprehensiv
44

55
| BlogPost | Publish Date |
66
| ---------------------------------------------------------------------------------------- | ------------ |
7+
| [Mediator Pattern - CQRS with MediatR](MediatorPattern/) | 06.08.2022 |
78
| [Logging Source Code Generators](LoggingSourceCodeGenerator/) | 27.07.2022 |
89
| [Blazor Client - Loading Screen](BlazorClientLoadingScreen/) | 12.07.2022 |
910
| [Central nuget store for your UNO Platform App](UnoDirectoryBuildProps/) | 23.06.2022 |

0 commit comments

Comments
 (0)