Writing your own MediatR from scratch in C#

Опубликовано: 28 Сентябрь 2024
на канале: Saeed Esmaeelinejad
1,010
45

I think most .NET developers already use or at least know about the MediatR Nuget package. It's an in-process messaging with no dependencies and supports request/response, commands, and notifications. Really cool Nuget library.

But have you thought about how MediatR works?

As I'm curious to know how things work, here I try to show the gist of MediatR and how to write your own one from scratch in C#.

The main idea is simple you need to create some instances of your handler at `runtime`.

Hope you like and nice to have your feedback as well.

Check the repo (CustomMediatR): https://github.com/sa-es-ir/youtube-s...

Moments

00:00 - Intro
00:44 - Code with MediatR
02:40 - Create our own Command/Hanlders
11:56 - Create Generic type at runtime!
16:30 - Implemenation of Send method
23:12 - Run code with custom MediatR

#dotnet #csharp #cqrs #mediatR
--------------------------------------------------------------------
LinkedIn Profile:
  / sa-es-ir