GithubHelp home page GithubHelp logo

dddeventsourcing's Introduction

Domain driven design and EventSourcing

DDD EventSourcing

  • .Net framework 4.6.1
  • Entity framework 6.0.0
  • Newtonjson 10.0.3
  • System.Data.SqlClient 4.4.2
  • MsSql 2008 or later

Guider

  • Clone and open with visual studio 2017
  • Rebuild all solution to restore nuget package
  • because I use IDatabaseInitializer (.net entity framework) so that Should care any change for Entity of DbContext. In my way I just delete table __MigrationHistory and do manual change for each table : ))

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 ...

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

class DomainEngine

  • To register handle to process Event and Command

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

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

  • each class for Domain business, inherit AggregateRoot and MUST create private functions Apply to apply Events. Why must create private Apply plz Check function LoadFromHistory in class AggregateRoot
  • function LoadFromHistory called at function Get in class CqrsEventSourcingRepository

ICqrsHandle

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

  • Check function DomainEngine.Boot() and find MemoryMessageBuss.RegisterAssembly(assembly);

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)

  • U can place your thin query facade eg: TestDbContext. And Implement your own EventPublisher
  • Do your own code base of your project here

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.

dddeventsourcing's People

Contributors

badpaybad avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.