MediatR is going commercial, so a lot of teams want a free way to handle in-process messaging in their .NET apps. Here is how to build your own.

In my latest video, I walk you through building your own alternative to MediatR. We cover the Mediator pattern, CQRS (Command Query Responsibility Segregation), and how to implement CQRS on top of the Mediator pattern.

You’ll see how to set up the basics for sending commands and queries, and how to get the right code to handle them.

We also touch on making things easier with Scrutor for registering these handlers.

The most useful part is the Source Generator. It generates the handler-wiring code at compile time, so you skip the runtime reflection most mediator libraries rely on.

Want to see how to build your own message handler in .NET and maybe move away from MediatR? Check out the video!

Let me know what you think!