Login

CQRS, Domain driven design and EventSourcing

Thoery coding: UI -> people Read and think -> people Do, action ... something -> UI push Command(s) -> Command Handle -> Build Object Domain by Events using Repository -> Domain call action(s) do business -> Repository store Events into EventSourcing Db -> Fire Event -> Event Handle write to Database Read -> Thin Query Facade from Db read -> UI ...

The benefit

DDD EventSourcing

Guider

Thoery coding

UI -> people Read and think -> people Do, action ... something -> UI push Command(s) -> Command Handle -> Build Object Domain by Events using Repository -> Domain call action(s) do business -> Repository store Events into EventSourcing Db -> Fire Event -> Event Handle write to Database Read -> Thin Query Facade from Db read -> UI ...

Dispatch Commands, Events handling

https://github.com/badpaybad/DDDEventSourcing/wiki/Step-to-step-to-implement-code

CqrsEventSourcingRepository and EventSourcingDbContext and EventSourcingDescription

EventSourcingDbContext

just db access for CqrsEventSourcingRepository

EventSourcingDescription

Entity (Table in db) to store Events fired from Domain object

CqrsEventSourcingRepository

Get Events and build them become Object Domain. CQRS require unique Identify for each Domain so that my solution for this Identify is: Type of Domain and Id of Domain. Actually table "EventSourcingDescription" have compose Primary key (Id,AggregateType,Version). So that Id of Domain (also Id for table in db read) can be Auto number, Guid ... or any things.

class MemoryMessageBuss

I just use Memory to fake message buss

DomainDrivenDesign.Core.Implements.MemoryQueue

Implement memory queue, use separte thread for real async process command and event

class DomainEngine

Domain business (DDD) (should learn how to analytic and design business by DDD)

eg: class Checkin inherit AggregateRoot as an Domain in this sample.

ICqrsHandle

Use to reflection to load dynamic file dll and register to MemoryMessageBuss ICommandHandle , IEventHandle inherit from ICqrsHandle

Workfollow

Can create separate project. It is simple like that. If some Event fired. Just register (subcribe) and call next command. This class also inherit IEventHandle but It should NOT directly write to db read. It just decide if an Event fired (mean an action of Domain done) which command should be the next call. eg: check class CheckinAndAutoNumberWorkfollow

DomainDrivenDesign.Core.Implements

(namespace or folder)

Developer guide:

DDD reference

Patterns always good but business analytic and design should be good first

Should try to learn DDD. Careful to create correct Domain and its actions, events. Because Events are history and they should not be remove or change.

Login to leave comment. Click here to login
Web hosting by Somee.com