D20Tek Mediator Articles

These articles describe different aspects of building .NET applications and services using the Mediator and Command design patterns with the D20Tek.Mediator package. The Mediator pattern is very common in .NET WebApi, so we will show various ways to use D20Tek.Mediator in that context. However, it is also very useful in client applications (Windows or Blazor or Razor pages) and console applications. So, we will also discuss the library in those project types as well.

These articles sometimes build upon one another so it’s best to start learning them in order. But once you know your way around the basics of D20Tek.Mediator, each article can be used independently.

The source code for these articles can be found in the following repository: https://github.com/d20Tek/d20tek-mediator/tree/main/samples.


Chapter 1: Getting Started

This chapter starts with the basic description of the Mediator and Command patterns. Then gets into setting up the project and adding the package dependency. And showing how to use D20Tek.Mediator in the simplest of scenarios.

1.1: Understanding the Mediator and Command Patterns: Theory, Use Cases, and Trade-offs
Learn the theory behind the Mediator and Command patterns and why they are important before diving into the D20Tek.Meditor implementation.

1.2: Setting up WebApi Sample Project
Step-by-step tutorial to create the basic WebApi project template with as a MinimalApi.

1.3: Getting Started with D20Tek.Mediator Package
Basic steps to install and start using D20Tek.Mediator package. Build and register your first command and command handler.

1.4: Is ASP.NET WebApi Pipeline Already a Mediator?
Taking a closer look at the WebApi pipeline through the lens of the Mediator and Command patterns. Lets you start with easy command handling and graduate to using D20Tek.Mediator as your service complexity grows.

1.5: Sync and Async CommandHandlers

Examples of writing CommandHandlers using both the ICommandHandler and ICommandHandlerAsync interfaces. And sending those messages via the IMediator.Send and IMediator.SendAsync functions.

1.6: Getting Started with Multi-Cast Notifications [coming soon…]