Go to file
2021-08-13 13:58:34 -04:00
Demo ready for version. 2021-08-13 13:58:34 -04:00
PoweredSoft.CQRS ready for 2.0.0 stable. 2021-08-11 17:05:56 -04:00
PoweredSoft.CQRS.Abstractions deprecating ODATA support in 3.x until we make the protocol work properly, also the library from microsoft is quite inconsistent when it comes to case ofthe property in their convention vs the property names in urls. 2021-08-13 12:21:27 -04:00
PoweredSoft.CQRS.AspNetCore net50 2021-08-13 12:45:41 -04:00
PoweredSoft.CQRS.AspNetCore.Abstractions ready for 2.0.0 stable. 2021-08-11 17:05:56 -04:00
PoweredSoft.CQRS.DynamicQuery ready for version. 2021-08-13 13:58:34 -04:00
PoweredSoft.CQRS.DynamicQuery.Abstractions ready for version. 2021-08-13 13:58:34 -04:00
PoweredSoft.CQRS.DynamicQuery.AspNetCore net50 2021-08-13 12:45:41 -04:00
PoweredSoft.CQRS.FluentValidation deprecating ODATA support in 3.x until we make the protocol work properly, also the library from microsoft is quite inconsistent when it comes to case ofthe property in their convention vs the property names in urls. 2021-08-13 12:21:27 -04:00
PoweredSoft.CQRS.GraphQL.Abstractions ready for 2.0.0 stable. 2021-08-11 17:05:56 -04:00
PoweredSoft.CQRS.GraphQL.DynamicQuery ready for version. 2021-08-13 13:58:34 -04:00
PoweredSoft.CQRS.GraphQL.FluentValidation deprecating ODATA support in 3.x until we make the protocol work properly, also the library from microsoft is quite inconsistent when it comes to case ofthe property in their convention vs the property names in urls. 2021-08-13 12:21:27 -04:00
PoweredSoft.CQRS.GraphQL.HotChocolate net50 2021-08-13 12:45:41 -04:00
PoweredSoft.CQRS.GraphQL.HotChocolate.DynamicQuery net50 2021-08-13 12:45:41 -04:00
.gitattributes Add .gitignore and .gitattributes. 2021-02-01 23:31:05 -05:00
.gitignore Add .gitignore and .gitattributes. 2021-02-01 23:31:05 -05:00
azure-pipeline.yaml Update azure-pipeline.yaml for Azure Pipelines 2021-02-07 00:25:20 -05:00
LICENSE Create LICENSE 2021-02-01 23:55:58 -05:00
PoweredSoft.CQRS.sln deprecating ODATA support in 3.x until we make the protocol work properly, also the library from microsoft is quite inconsistent when it comes to case ofthe property in their convention vs the property names in urls. 2021-08-13 12:21:27 -04:00
README.md Update README.md 2021-08-11 17:15:34 -04:00

CQRS

Our implementation of query and command responsability segregation (CQRS).

Getting Started

Install nuget package to your awesome project.

Full Version NuGet NuGet Install
PoweredSoft.CQRS.Abstractions NuGet PM> Install-Package PoweredSoft.CQRS.Abstractions
PoweredSoft.CQRS NuGet PM> Install-Package PoweredSoft.CQRS
PoweredSoft.CQRS.FluentValidation NuGet PM> Install-Package PoweredSoft.CQRS.FluentValidation
PoweredSoft.CQRS.AspNetCore.Abstractions NuGet PM> Install-Package PoweredSoft.CQRS.AspNetCore.Abstractions
PoweredSoft.CQRS.AspNetCore NuGet PM> Install-Package PoweredSoft.CQRS.AspNetCore
PoweredSoft.CQRS.GraphQL.HotChocolate NuGet PM> Install-Package PoweredSoft.CQRS.GraphQL.HotChocolate

Sample of startup code for aspnetcore MVC

public void ConfigureServices(IServiceCollection services)
{
    // make sure to add your queries and commands before the .AddPoweredSoftQueries and .AddPoweredSoftCommands
    AddQueries(services);
    AddCommands(services);

    // adds the non related to aspnet core features.
    services.AddPoweredSoftCQRS();
    
    services
        .AddControllers()
        .AddPoweredSoftQueries() // adds queries to aspnetcore mvc.(you can make it configurable to load balance only commands on a instance)
        .AddPoweredSoftCommands() // adds commands to aspnetcore mvc. (you can make it configurable to load balance only commands on a instance)
        .AddFluentValidation();

    // enabling gql.
    services
        .AddGraphQLServer()
        .AddProjections()
        .AddQueryType(d => d.Name("Query"))
        .AddPoweredSoftQueries()
        .AddPoweredSoftDynamicQueries()
        .AddMutationType(d => d.Name("Mutation"))
        .AddPoweredSoftMutations();

    services.AddSwaggerGen();
}

Example how to add your queries and commands.

private void AddCommands(IServiceCollection services)
{
    services.AddCommand<CreatePersonCommand, CreatePersonCommandHandler>();
    services.AddTransient<IValidator<CreatePersonCommand>, CreatePersonCommandValidator>();

    services.AddCommand<EchoCommand, string, EchoCommandHandler>();
    services.AddTransient<IValidator<EchoCommand>, EchoCommandValidator>();
}

private void AddQueries(IServiceCollection services)
{
    services.AddQuery<PersonQuery, IQueryable<Person>, PersonQueryHandler>();
}

Fluent Validation

We use fluent validation in all of our projects, but we don't want it to be enforced.

If you install. PoweredSoft.CQRS.FluentValidation you can use this way of registrating your commands.

public void ConfigureServices(IServiceCollection services) 
{
    // without Package.
    services.AddCommand<EchoCommand, string, EchoCommandHandler>();
    services.AddTransient<IValidator<EchoCommand>, EchoCommandValidator>();
}

public void ConfigureServices(IServiceCollection services) 
{
    // with PoweredSoft.CQRS.FluentValidation package.
    services.AddCommandWithValidator<EchoCommand, string, EchoCommandHandler, EchoCommandValidator>();
}