> This project was originally initiated by [Powered Software Inc.](https://poweredsoft.com/) and was forked from the [PoweredSoft.CQRS](https://github.com/PoweredSoft/CQRS) Repository # CQRS Our implementation of query and command responsibility segregation (CQRS). ## Getting Started > Install nuget package to your awesome project. | Full Version | NuGet | NuGet Install | |-----------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-----------------------------------------------------------------------:| | OpenHarbor.CQRS | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS/) | ```PM> Install-Package OpenHarbor.CQRS ``` | | OpenHarbor.CQRS.AspNetCore | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.AspNetCore.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.AspNetCore/) | ```PM> Install-Package OpenHarbor.CQRS.AspNetCore ``` | | OpenHarbor.CQRS.FluentValidation | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.FluentValidation.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.FluentValidation/) | ```PM> Install-Package OpenHarbor.CQRS.FluentValidation ``` | | OpenHarbor.CQRS.DynamicQuery | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.DynamicQuery.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.DynamicQuery/) | ```PM> Install-Package OpenHarbor.CQRS.DynamicQuery ``` | | OpenHarbor.CQRS.DynamicQuery.AspNetCore | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.DynamicQuery.AspNetCore.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.DynamicQuery.AspNetCore/) | ```PM> Install-Package OpenHarbor.CQRS.DynamicQuery.AspNetCore ``` | > Abstractions Packages. | Full Version | NuGet | NuGet Install | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -----------------------------------------------------: | | OpenHarbor.CQRS.Abstractions | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.Abstractions.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.Abstractions/) | ```PM> Install-Package OpenHarbor.CQRS.Abstractions ``` | | OpenHarbor.CQRS.AspNetCore.Abstractions | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.AspNetCore.Abstractions.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.AspNetCore.Abstractions/) | ```PM> Install-Package OpenHarbor.CQRS.AspNetCore.Abstractions ``` | | OpenHarbor.CQRS.DynamicQuery.Abstractions | [![NuGet](https://img.shields.io/nuget/v/OpenHarbor.CQRS.DynamicQuery.Abstractions.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/OpenHarbor.CQRS.DynamicQuery.Abstractions/) | ```PM> Install-Package OpenHarbor.CQRS.AspNetCore.Abstractions ``` | ## Sample of startup code for aspnetcore MVC ```csharp public void ConfigureServices(IServiceCollection services) { // make sure to add your queries and commands before configuring MvCBuilder with .AddOpenHarborCommands and .AddOpenHarborQueries AddQueries(services); AddCommands(services); // adds the non related to aspnet core features. services.AddOpenHarborCQRS(); services .AddControllers() .AddOpenHarborQueries() // adds queries to aspnetcore mvc.(you can make it configurable to load balance only commands on a instance) .AddOpenHarborCommands() // adds commands to aspnetcore mvc. (you can make it configurable to load balance only commands on a instance) .AddFluentValidation(); services.AddSwaggerGen(); } ``` > Example how to add your queries and commands. ```csharp private void AddCommands(IServiceCollection services) { services.AddCommand(); services.AddTransient, CreatePersonCommandValidator>(); services.AddCommand(); services.AddTransient, EchoCommandValidator>(); } private void AddQueries(IServiceCollection services) { services.AddQuery, PersonQueryHandler>(); } ``` # Fluent Validation We use fluent validation in all of our projects, but we don't want it to be enforced. If you install ```OpenHarbor.CQRS.FluentValidation``` you can use this way of registrating your commands. ```csharp public void ConfigureServices(IServiceCollection services) { // without Package. services.AddCommand(); services.AddTransient, EchoCommandValidator>(); } public void ConfigureServices(IServiceCollection services) { // with OpenHarbor.CQRS.FluentValidation package. services.AddCommand(); } ``` # 2024 Roadmap | Task | Description | Status | |----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|--------| | Support .NET 8 | Ensure compatibility with .NET 8. | ✅ | | Create a new demo project as an example | Develop a new demo project to serve as an example for users. | ⬜️ | | New Independent Module for MVC | Develop a standalone module, independent of MVC, to enhance framework flexibility. | ⬜️ | | Implement .NET Native Compilation (AOT) | Enable Ahead-of-Time (AOT) compilation support for .NET 8. | ⬜️ | | Update FluentValidation | Upgrade FluentValidation to the latest version, addressing potential breaking changes. | ⬜️ | | Create a website for the Framework | Develop a website to host comprehensive documentation for the framework. | ⬜️ | | Re-add support for GraphQL | Re-integrate support for GraphQL, exploring lightweight solutions. | ⬜️ |