Does validation in CQRS have to occur separately once in the UI, and once in the business domain?

I think my question has just been solved by another article, Clarified CQRS by Udi Dahan. The section “Commands and Validation” starts as follows: Commands and Validation In thinking through what could make a command fail, one topic that comes up is validation. Validation is different from business rules in that it states a context-independent … Read more

How to instantiate Mediatr as part of a Unit Test?

You’re on the right lines with or a mockup – you need to mock the IMediator There’s a few mocking libraries out there: Moq FakeItEasy NSubstitute Moq is one of the most popular, so, using your test as an example: [Fact] public async void UpdateCustomerCommand_CustomerDataUpdatedOnDatabase() { //Arrange var mediator = new Mock<IMediator>(); UpdateCustomerCommand command = … Read more

What difference between NEventStore and EventStoreDB

NEventStore is a persistence agnostic event sourcing library for .NET with multiple storage options such as relational and document databases. EventStoreDB is a newer and high performing event sourcing solution with its own persistence engine and API’s for multiple protocols and languages. It has open source and commercial options. As far as I know you … Read more

What is an example of a task based UI?

The easiest way to generate a task based UI is to protect all attributes/properties of your models. i.e. remove all setters. From this (pseudo code): public class TodoTask { public Date getDateAssigned(); public void setDateAssigned(Date); public string getAssignedTo(); public void setAssignedTo(string); } to this: public class TodoTask { public Date getDateAssigned(); public string getAssignedTo(); public … Read more

Event Sourcing and Read Model generation

Personally I think there’s nothing wrong with looking up the user’s name from within the event handler. But if you’re in a position where you can’t query the name from the User’s read model then I’d introduce an additional event handler to QuestionEventsHandler, to handle the UserRegistered event. That way the QuestionEventsHandler could maintain its … Read more