Skip to content

Proof of Concept of a CQRS pattern, using library MediatR.

Notifications You must be signed in to change notification settings

lucaslimadevs/CQRS_poc

Repository files navigation

CQRS + MediatR ASP.NET Core API

Proof of Concept of a CQRS pattern, using library MediatR.

Simple API built using ASP.NET Core and MediatR to demonstrate how to easily implement the CQRS pattern in .NET applications.

The example API is very simple, exposing HTTP endpoints through /api/customers that internally use MediatR to handle requests and responses.

Frameworks and Libraries

How to Test

Run the following commands, in sequence, inside the application directory:

dotnet restore
dotnet run

Navigate to https://localhost:7094/swagger/index.html to check the API documentation and test all endpoints.

Limitations

The API does not show how to implement distinct databases to read and write data, nor shows advanced synchronization features. The application just shows examples of using MeadiatR and, consequently, the mediator pattern to handle request and responses in a CQRS approach.

API Reference

Find Customers

  POST /api/Customer/Find
Parameter Type Description
name string Find by customer name
address string Find by Customer address
phone string Find by Customer phone
email string Find by Customer email

Get Customer by Id

  GET /api/Customer/${id}
Parameter Type Description
id int Required. Id of item to fetch

Post Customer

  POST /api/Customer/Insert
Parameter Type Description
id int Required. Id
name string Customer name
address string Customer address
phone string Customer phone
email string Customer email

Disable Customer

  POST /api/Customer/Disable/${id}
Parameter Type Description
id int Required. Id of item to fetch

About

Proof of Concept of a CQRS pattern, using library MediatR.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages