Mediator pattern
I have been criticized for implementing the mediator pattern in many companies. Everyone rightly want to use MediaR. I wrote the mediator pattern many years ago using reflection, after C# added functional programming I changed to the implementation below. I also have implemented using Java 8 chaining functions following a filter pipe to route request based on Type.
I was looking to leverage minimal external libraries as oppositive to use open source libraries as building block that leads me to this implementation.
Mediator pattern is commonly used to decouple components, whether is direct calls or message driven. I wrote a simple function that decouple components and leverage Dot Net Core service collection to route request.
Usage:
Implementation: