MediatR and Magic

Having recently watched Greg Young’s excellent talk on 8 Lines of Code I was thinking about how this kind of thinking applies to the mediator pattern, and specifically the MediatR implementation. I have written about the advantages of CQRS with MediatR before, but having used it for a long time now, there are some parts which cause friction on a regular basis. The problems Discoverability The biggest issue first. You have a controller with the following constructor:...

January 7, 2017 · 3 min

CQS with Mediatr

This article is some extra thoughts I had on api structure after reading Derek Comartin. Asides from the benefits that Derek mentions (no fat repositories, thin controllers), there are a number of other advantages that this style of architecture brings. Ease of Testing By using Command and Queries, you end up with some very useful seams for writing tests. For controllers With controllers, you typically use Dependency injection to provide an instance of IMediator:...

March 19, 2016 · 3 min