Giter Site home page Giter Site logo

nilavpatel / todo.cqrs Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 0.0 571 KB

CQRS and Event Sourcing sample application and architecture

License: MIT License

C# 99.61% TSQL 0.39%
cqrs cqrs-framework asp-net-core csharp event-sourcing ddd-architecture ddd-cqrs aggregate repository-pattern domain-driven-design

todo.cqrs's Introduction

CQRS + ES + DDD + .NET 5.0

CQRS stands for Command and Query Responsibility Segregation
ES stands for Event Sourcing
DDD stands for Domain Driven Design

Features

  • Commands and handlers
  • Domain models (Aggregates)
  • Aggregate repository
  • Event sourcing using EventStore
  • Domain events and handlers (Projections)
  • Integration events and handlers (Cross module projections)
  • Read models
  • Query controllers
  • Unit of work, Read repository, Write repository
  • Auto registration of commands, events and their handlers
  • Unit of work for multiple aggregates
  • Snapshots, Snapshot repository, Snapshot storage in eventstore db
  • Checkpoint, Checkpoint repository, Checkpoint storage in eventstore db
  • Class for sequential GUIDs
  • Entity tracking for write repository and no tracking for read repository

Notes:

  • Inherit domain model with AggregateRoot or SnapshotAggregateRoot<Snapshot>.
  • Domain model must have a parameterless constructor with a private access modifier.
  • Set all setters with private modifier to all properties in the domain model.
  • Domain layer has no dependencies except Contracts layer.
  • All business logic and validation should be written in domain models.
  • Contracts contain Command and Event classes, no business logic should be written in Contracts.
  • All database updates are done from EventHandler only.
  • Use IReadRepository for query controllers.
  • Use sequential Guids CombGuid.NewGuid() instead of Guid.NewGuid().
  • Use IUnitOfWork to update data in event handlers.
  • Start background processor before starting web app
  • AggregateVersion start from 1, where in EventStore event version start from 0.

Diagrams:

CQRS AggregateRepository-GetAggregate

todo.cqrs's People

Contributors

nilavpatel avatar

Stargazers

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