Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jincod/jincod.cqrs
Interfaces for develop app using CQRS principle
https://github.com/jincod/jincod.cqrs
cqrs dotnet dotnet-core
Last synced: about 5 hours ago
JSON representation
Interfaces for develop app using CQRS principle
- Host: GitHub
- URL: https://github.com/jincod/jincod.cqrs
- Owner: jincod
- License: mit
- Created: 2015-01-21T11:31:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-17T17:00:04.000Z (about 6 years ago)
- Last Synced: 2024-11-10T16:16:05.263Z (9 days ago)
- Topics: cqrs, dotnet, dotnet-core
- Language: C#
- Homepage:
- Size: 48.8 KB
- Stars: 7
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jincod.CQRS
[![Build status](https://ci.appveyor.com/api/projects/status/mieoljc0aj53765m?svg=true)](https://ci.appveyor.com/project/jincod/jincod-cqrs)
[![NuGet](https://img.shields.io/nuget/v/jincod.cqrs.svg)](https://www.nuget.org/packages/Jincod.CQRS)Interfaces for develop app using CQRS principle
## Installation
NuGet package [Jincod.CQRS](https://www.nuget.org/packages/Jincod.CQRS)
```PowerShell
Install-Package Jincod.CQRS
```
or```bash
dotnet add package Jincod.CQRS
```## Usage
### Query
QueryContext
```csharp
public class SimpleQueryContext : IQueryContext
{
}
```Query
```csharp
public class SimpleQuery : IQuery
{
public Task ExecuteAsync(SimpleQueryContext queryContext)
{
return Task.FromResult(new SimpleEntity { Name = "Simple1" });
}
}
```QueryProcessor
```csharp
var queryProcessor = container.Resolve();
var context = new SimpleQueryContext();
var simpleEntity = await queryProcessor.ProcessAsync(context);
```### Commands
Command
```csharp
public class SimpleCommand : ICommand
{
}
```CommandHandler
```csharp
public class SimpleCommandHandler : ICommandHandler
{
public Task HandleAsync(SimpleCommand command)
{
// do something
return Task.CompletedTask;
}
}
```CommandProcessor
```csharp
var commandProcessor = container.Resolve();
var simpleCommand = new SimpleCommand();
await commandProcessor.ProcessAsync(simpleCommand);
```View [Full example](https://github.com/jincod/Jincod.CQRS/tree/master/Example)