If you were following my blog you might have noticed there was not much activity in the Event Sourcing framework I was doing in my free time. The main reason for this is that some time ago I decided to change job and will work as a DevOps Engineer at Unsilo, so I started focusing on using my free time in something more relevant for my next job. Very soon I will also loose my Windows box so I will not be able to code C# more so I think unfortunately I will have to leave this project midways…
If you are looking for CQRS library with a very active community try to check out d60 Cirqus, developed by my soon to be ex-colleagues down at d60.
I decided to start working on a simple example, a bank application, that shows how aggregates can be modeled using Diyes.
The aggregate I decided to model is a bank account, it will exemplify some basic concepts of aggregate modeling. First of, we create a class that inherits from AbstractAggregate
public class Account : AbstractAggregate
How we normally go about modeling aggregates is we expose methods which are the commands that can be performed on our aggregates. So in this case I decided to have an Open, a Deposit and a Withdraw method. First thing we do in these methods is checking the preconditions for their execution, if the preconditions are met, we apply an event describing what happened. Continue reading diyes: practical modeling of aggregates
After we have seen how the event store works by saving and loading events related with an identity, in this post I am going up in the abstraction layer and talk about aggregates. A very good introduction to aggregate design can be found in Vaughn Vernons’ articles – Effective Aggregate Design.
Continue reading diyes: time for aggregates
For the more lazy ones that decided to skip the event sourcing literature that I suggested in my first post, I will try to explain a bit of how it works. Bear in mind, I am myself try to get to understand better how Event Sourcing (ES) and CQRS so my explanations might not be the best.
So basically, instead of having objects containing a state to represent our business objects, with event sourcing we have a sequence of events that describe what happened to our aggregates (in ES these business objects are called aggregates).
Continue reading diyes: laying the foundation