Giter VIP home page Giter VIP logo

asp-net-cqrs-redis-reference's Introduction

CQRS and Event Sourcing with ASP.Net Core 2.0 and Redis

This is a simple CQRS and Event Sourcing application using ASP.Net Core 2.0, CQRSlite and Redis. The following design patterns are used:

  • Command Query Responsibility Separation (CQRS).
  • Event Sourcing

The following technologies are used

  • ASP.Net Core 2.0
  • CQRSlite
  • Redis

Prerequisites

The system consists of two Web API applications and an underlying Redis cache. The following software is required to build and run the code

  • .NET Core 2.0 SDK
  • Redis 4.0.6

Running this Example

1. Build the Code

Clone the Git repository to a directory

git clone https://github.com/drm317/asp-net-cqrs-redis-reference.git

Then build the code within your IDE.

2. Start the Services

There are three services in this example

  • Redis - Used for the read model data store
  • Command - CQRS command service used to create orders
  • Query - CQRS query service used to query orders

The CQRSlite framework is used to provide a basic CQRS infrastructure. Order creation events are written to an in-memory event store by the command service. An event handler publishes these events and an entry is cached in the Redis read data store for the query service.

  • Start the Redis service. It can be installed as a service on Windows and Nix systems or started manually from the command line.

  • Start the Command and Query services in your IDE.

3. Run the Tests

The AspNetCoreCqrsRedis.Test test project includes unit and integration tests.

  • Unit Tests - The WhenOrderCreated.cs unit test uses fake implementations of the key CQRSlite framework classes. It covers the order creation scenario and verifies that an OrderCreatedEvent is correctly handled.

  • Integration Tests - The EndToEndTest.cs integration test creates an order via the Command service. The event store is updated and an event is published to the query read data store. The Query service returns the cached order from the read data store.

asp-net-cqrs-redis-reference's People

Contributors

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