Some notes on the DDD/CQRS Course
Marco Franssen

Loading...
Marco Franssen

In this blog post I work out some of the notes I made in Greg Young’s DDD/CQRS course in Krakow Poland.
In Domain Driven Design there are some important things to think about. In DDD we make a difference in the following components.
An Aggregate root is a set of multiple things that belong to each other. The aggregate should have a name that describes the whole.
To come to a domain driven design you should take the following steps:
When applying the above you should mention the bullets below when applying them:
Even without transactions you can provide consistency in your systems. We can do this by merging. You can do this with the following code-snippet. Notice the recursive call in the catch clause.
public class MergingHandler<T> : Consumes<T>
{
public MergingHandler(Consumes<T> next)
{
}
public void Consume(T message)
{
try
{
var commit = eventStore.GetEventsSinceVersion(message.AggregateId, message.ExpectedVersion);
next.Handle(message);
foreach(var e in commit)
{
foreach (vat attempted in UnitOfWork.Current.PeekAll())
{
if (ConflictsWith(attempted, e)) {
throw new RealConcurrencyException();
}
}
}
UnitOfWork.Current.Commit();
}
catch(ConcurrencyException e) {
this.Consume(message);
}
}
}Marco Franssen
While I was trying to apply DDD in combination with CQRS I learned myself some good lessons. I was trying to apply this in an agile approach, using the project method SCRUM. I started the project by translating all use-cases to smaller user stories. Based on this user stories I defined a first sprint. In the first sprint I didn't had or make a design for the complete domain. So I wasn't completely sure if I made the right decision for the 'aggregate root / bounded contexts' needed for the firs…
Marco Franssen
In this blog post I will explain how to inject your dependencies into your controllers in a MVC 3 application with Castle Windsor. First of all you need to create a WindsorInstaller. This class is responsible for the configuration of your IoC container. In the above class the first line registers all your controllers with lifestyle configured to Transient. Depending on the lifestyle you choose Windsor will clean all resources. Other lifestyles are Singleton, Pooled, PerWebRequest, PerThread. T…