RapidCqrs 0.1.3

Easy library for CQRS

Install-Package RapidCqrs -Version 0.1.3
dotnet add package RapidCqrs --version 0.1.3
<PackageReference Include="RapidCqrs" Version="0.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RapidCqrs --version 0.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

RapidCQRS

This is free .NET Standard 2.0 library for Command Query Responsibilyty Segregation. You can use this library with .NET Core >= 2.0 and .NET Framework >= 4.61

Getting Started

These instructions will help you to attach this library to your project

Installing

Instalation with Nuget

Install-Package RapidCqrs

For autofac integration use RapidCqrs.Authofac

Install-Package RapidCqrs.Autofac

Usage

With autofac integration

  static void Main(string[] args)
        {
	    var containerBuilder = new ContainerBuilder();
            containerBuilder
                .AddRapidCqrs()
                .Register(typeof(MySimpleCommandHandler)) // Register manualy
                .Register<MySimpleEventHandler>() // Register manualy generic way
                .RegisterDefaultHandler<MyDefaultHandler>();
                //.RegisterDefaultHandler(typeof(MyDefaultHandler));
            //.AutoRegisterHandlers(Assembly.GetEntryAssembly()); // Register automatically

            containerBuilder
                .RegisterType<TestParam>()
                .AsSelf();

            IContainer container = containerBuilder
                .Build();

            var mediator = container.Resolve<IMediator>();

            mediator.Send(new MySimpleEvent());
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
            mediator.Send(new MyAnotherEvent());
		}

With any another cointainer

  static void Main(string[] args)
        {
	    var containerBuilder = new ContainerBuilder();
            var cqrsBuilder = new CqrsBuilder();

            cqrsBuilder
                //.Register(typeof(MySimpleCommandHandler)) // Register manualy
                //.Register(typeof(MySimpleEventHandler));
                .AutoRegisterHandlers(Assembly.GetEntryAssembly()) // Register automatically                
                .RegisterContainer(new ContainerRegistration(x => containerBuilder.RegisterType(x).AsSelf()));

            containerBuilder
                .Register(x =>
                {
                    var scope = x.Resolve<ILifetimeScope>();
                    cqrsBuilder.RegisterResolver(new BasicHandlerResolver(scope.Resolve));
                    return cqrsBuilder.Build();
                })
                .As<IMediator>()
                .SingleInstance();

            containerBuilder
                .RegisterType<TestParam>()
                .AsSelf();

            var container = containerBuilder
                .Build();

            var mediator = container.Resolve<IMediator>();
            mediator.SendAsync(new MySimpleEvent());
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
		}

Without any container

  static void Main(string[] args)
        {
            var cqrsBuilder = new CqrsBuilder();
            var mediator = cqrsBuilder
                //.Register(typeof(MySimpleCommandHandler)) // Register manualy
                //.Register(typeof(MySimpleEventHandler));
                .AutoRegisterHandlers(Assembly.GetEntryAssembly()) // Register automatically                
                .Build();

            // mediator.SendAsync(new MySimpleEvent()); // No parametreless constructor exception
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
        }

Authors

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Need help with event sourcing?

https://msdn.microsoft.com/en-us/library/jj554200.aspx
https://docs.microsoft.com/en-us/nuget/consume-packages/ways-to-install-a-package

RapidCQRS

This is free .NET Standard 2.0 library for Command Query Responsibilyty Segregation. You can use this library with .NET Core >= 2.0 and .NET Framework >= 4.61

Getting Started

These instructions will help you to attach this library to your project

Installing

Instalation with Nuget

Install-Package RapidCqrs

For autofac integration use RapidCqrs.Authofac

Install-Package RapidCqrs.Autofac

Usage

With autofac integration

  static void Main(string[] args)
        {
	    var containerBuilder = new ContainerBuilder();
            containerBuilder
                .AddRapidCqrs()
                .Register(typeof(MySimpleCommandHandler)) // Register manualy
                .Register<MySimpleEventHandler>() // Register manualy generic way
                .RegisterDefaultHandler<MyDefaultHandler>();
                //.RegisterDefaultHandler(typeof(MyDefaultHandler));
            //.AutoRegisterHandlers(Assembly.GetEntryAssembly()); // Register automatically

            containerBuilder
                .RegisterType<TestParam>()
                .AsSelf();

            IContainer container = containerBuilder
                .Build();

            var mediator = container.Resolve<IMediator>();

            mediator.Send(new MySimpleEvent());
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
            mediator.Send(new MyAnotherEvent());
		}

With any another cointainer

  static void Main(string[] args)
        {
	    var containerBuilder = new ContainerBuilder();
            var cqrsBuilder = new CqrsBuilder();

            cqrsBuilder
                //.Register(typeof(MySimpleCommandHandler)) // Register manualy
                //.Register(typeof(MySimpleEventHandler));
                .AutoRegisterHandlers(Assembly.GetEntryAssembly()) // Register automatically                
                .RegisterContainer(new ContainerRegistration(x => containerBuilder.RegisterType(x).AsSelf()));

            containerBuilder
                .Register(x =>
                {
                    var scope = x.Resolve<ILifetimeScope>();
                    cqrsBuilder.RegisterResolver(new BasicHandlerResolver(scope.Resolve));
                    return cqrsBuilder.Build();
                })
                .As<IMediator>()
                .SingleInstance();

            containerBuilder
                .RegisterType<TestParam>()
                .AsSelf();

            var container = containerBuilder
                .Build();

            var mediator = container.Resolve<IMediator>();
            mediator.SendAsync(new MySimpleEvent());
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
		}

Without any container

  static void Main(string[] args)
        {
            var cqrsBuilder = new CqrsBuilder();
            var mediator = cqrsBuilder
                //.Register(typeof(MySimpleCommandHandler)) // Register manualy
                //.Register(typeof(MySimpleEventHandler));
                .AutoRegisterHandlers(Assembly.GetEntryAssembly()) // Register automatically                
                .Build();

            // mediator.SendAsync(new MySimpleEvent()); // No parametreless constructor exception
            MySimpleResponse resp = mediator.Execute(new MySimpleCommand());
        }

Authors

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Need help with event sourcing?

https://msdn.microsoft.com/en-us/library/jj554200.aspx
https://docs.microsoft.com/en-us/nuget/consume-packages/ways-to-install-a-package

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.1.3 341 5/6/2018
0.1.1 289 4/13/2018
0.1.0 325 4/11/2018