RapidCqrs 0.1.3
dotnet add package RapidCqrs --version 0.1.3
NuGet\Install-Package RapidCqrs -Version 0.1.3
<PackageReference Include="RapidCqrs" Version="0.1.3" />
paket add RapidCqrs --version 0.1.3
#r "nuget: RapidCqrs, 0.1.3"
// Install RapidCqrs as a Cake Addin #addin nuget:?package=RapidCqrs&version=0.1.3 // Install RapidCqrs as a Cake Tool #tool nuget:?package=RapidCqrs&version=0.1.3
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
- Przemysław Grzywa - Przemko92
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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RapidCqrs:
Package | Downloads |
---|---|
RapidCqrs.Autofac
Autofac integration for RapidCqrs |
GitHub repositories
This package is not used by any popular GitHub repositories.