Skip to content

Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Follow @CodeOpinion

How to get started with CQRS & Event Sourcing

When I first heard about CQRS & Event Sourcing concepts through various blogs and videos, primarily from Greg Young and Udi Dahan, I wanted to apply it everywhere. It seems really natural to want to take the limited knowledge we have about a new concept or technology and try and apply it to any problem. Most of us know this is a terrible idea, but we are so tempted to push the concepts on a problem that it just doesn’t fit. I realize I’m grouping CQRS and Event Sourcing together in this post.  Generally, if you are applying Event Sourcing then… Read More »How to get started with CQRS & Event Sourcing

Handling Async Await Exceptions

Async/Await There’s a ton of information about async await support in .NET 4.5.  I don’t want to go over all the best practices and gotchas in this post, but I did want to point out one common trend I’ve seen lately, which is handling async await exceptions. Await or forget about it Any async method that returns a Task or Task<T>, you should always await the result. If you do not await, any exceptions that occur in the calling method will be swallowed.  Essentially you are turning the method call into a fire and forget. Async Await Exceptions Example Below is a simple example that… Read More »Handling Async Await Exceptions

Mediator Pattern using MediatR and Unity

In a couple previous posts I’ve discussed using Query Objects instead of Repositories and the Mediator pattern.  I find creating query objects being used with the command pattern much cleaner than polluting repositories with a ton of query methods. The concept is nothing new as many people already use the command pattern in the context of executing commands/behavior following CQRS.   However, there is nothing wrong with using the same patterns for the query side. I’ve been using my own home grown solution of the mediator pattern in a few different projects but had nothing really formalized.  I was thinking about creating a simple library… Read More »Mediator Pattern using MediatR and Unity