cqrs

How is Command Query Separation (CQS) implemented when using an ORM?

The principle behind the CQS architectural pattern is that you separate your queries and commands into distinct paths. Ideally, your persistence store can be read/write partitioned, but in my case, there is a single, normalized database. If you are using an ORM (NHibernate in my case), it's clear that the ORM is used when issuing comma...

How to implement CQS with in memory changes?

Having Watched this video by Greg Yound on DDD http://www.infoq.com/interviews/greg-young-ddd I was wondering how you could implement Command-Query Separation (CQS) with DDD when you have in memory changes? With CQS you have two repositories, one for commands, one for queries. As well as two object groups, command objects and query o...

How To Implement The Query Side Of CQS in DDD?

I have implemented the command side of DDD using the domain model and repositories, but how do I implement the query side? Do I create an entirely new domain model for the UI, and where is this kept in the project structure...in the domain layer, the UI layer, etc? Also, what do I use as my querying mechanism, do I create new repositor...

CQRS and CRUD screens

One of the basic tenets of CQRS, as I understand it, is that commands should be behaviour-centric, and have a value in the business or the UL, and not data-centric, ie., CRUD. Instead of focusing on updating a customer, we have commands like CustomerHasMoved. What if you have CRUD screens which are there to correct certain data. For exam...

NServicebus / CQRS: How to handle things in the userinterface?

I've been reading Udi Dahan's text on [Command Query separation and SOA][1]. Thinking about how I would use this in practice in a system I'm currently working on raised some questions... 1. Consider the following situation where I have a WPF client application that allows the user to edit a list of entries: The client application is...

Domain queries in CQRS

We are trying out CQRS. We have a validation situation where a CustomerService (domain service) needs to know whether or not a Customer exists. Customers are unique by their email address. Our Customer repository (a generic repository) only has Get(id) and Add(customer). How should the CustomerService find out if the Customer exists? ...

CQRS - The query side

A lot of the blogsphere articles related to CQRS (command query repsonsibility) seperation seem to imply that all screens/viewmodels are flat. e.g. Name, Age, Location Of Birth etc.. and thus the suggestion that implementation wise we stick them into fast read source etc.. single table per view mySQL etc.. and pull them out with somethi...

How to Command Query Responsibility Segregation (CQRS) with ASP.NET MVC?

I have been reading about Command Query Responsibility Segregation (CQRS). I sort of wonder how would this work with ASP.NET MVC? I get the idea of CQRS conceptually it sounds nice and sure does introduce some complexities (event and messaging pattern) compared to the "normal/common" approach . Also the idea of CQRS sort of against the u...

CQRS event versioning

Versioning If your events changes you would create a new version of that event, and keep the old ones. To keep your domain code form being bloated with handling of all versions of events you would basically introduce a component that converts your events from previous to newer versions, and then apply them on the domain. Remember...

CQRS - how to handle new report tables (or: how to import ALL history from the event store)

I've studied some CQRS sample implementations (Java / .Net) which use event sourcing as the event store and a simple (No)SQL stores as the 'report store'. Looks all good, but I seem to be missing something in all sample implementations. How to handle the addition of new report stores / screens, after an application has gone in producti...

Command Query Separation validating for retries

So I'm comfortable with the basic concept of CQS, where you might have a command that writes to one database, and that updates the query database that you read from. However, consider the scenario where you are entering data, and want to prevent duplicates. Using new employee data entry an employee register as an example, working throu...

Should an event-sourced aggregate root have access to the event sourcing repository?

I'm working on an event-sourced CQRS implementation, using DDD in the application / domain layer. I have an object model that looks like this: public class Person : AggregateRootBase { private Guid? _bookingId; public Person(Identification identification) { Apply(new PersonCreatedEvent(identification)); } ...

CQRS and email notification

Reading up on CQRS there is a lot of talk of email notification - i'm wondering where to get the data from. Imagine a senario where one user invites other users to an event. To inform a user that he has been invitet to an event, he is send an email. The concrete mecanics might go like this: A "CreateEvent" command with an associated...

How to handle set based consistency validation in CQRS?

I have a fairly simple domain model involving a list of Facility aggregate roots. Given that I'm using CQRS and an event-bus to handle events raised from the domain, how could you handle validation on sets? For example, say I have the following requirement: Facility's must have a unique name. Since I'm using an eventually consiste...

In CQRS (event-sourced), do you need a global sequence counter in the event store?

In trying to get my head around CQRS (and DDD in general) I have come across situations when two events occur on different aggregates but the order of them has domain meaning. If so then they could happen so close together that a timestamp (as used by the sample implementations I have seen) cannot differentiate them, meaning the event s...

Mixing Transaction Script pattern with DDD/CQRS

Hi all, Here is the situation, in order to support our legacy system, we need to insert to a table whenever a user logs in. This is basically an CRUD operation, so it doesn't really make sense to create repository/entity/command/event for this since this doesn't tie to any business rules at all. The only benefit to create a CQRS comman...

Can I architect a web app so it can be deployed to either the cloud or a dedicated server / VPS ? How?

Is there are an architecture versatile enough that it may be deployed to either a cloud server or to a dedicated (or VPS) server with minimal change? Obviously there would be config changes but I'd rather leave the rest of the app consistent, keeping one maintainable codebase. The app would be ASP.NET &/or ASP.MVC. My dev environment is...

CQRS - Should a Command try to create a "complex" master-detail entity?

I've been reading Greg Young and Udi Dahan's thoughts on Command Query Responsibilty Separation and a lot of what I read strikes a chord with me. My domain (we track vehicles which are doing deliveries) has the concept of a Route which contains one or more Stops. I need my customers to be able to set these up in our system by calling a...

Is there a stackoverflow/reddit/slashdot PHP clone that supports CQRS?

CQRS means Command Query Responsibility Segregation. ...

Inter-Aggregate Communication in CQRS + DDD + Event Sourcing

How should separate aggregate roots communicate with one another in an environment built on DDD principles using an event-sourced aggregate back-end? For instance, I have a Facility aggregate root (AR) which has a factory method responsible for creating a Booking AR. The Booking is a time-sensitive combination of a Person AR and a Faci...