Working on a command dispatcher

This commit is contained in:
Janus Knudsen 2025-03-10 18:10:00 +01:00
parent 31666b4ba0
commit a86a2d7ade
5 changed files with 55 additions and 4 deletions

View file

@ -0,0 +1,24 @@
using Autofac;
using PlanTempus.Core.SeqLogging;
namespace PlanTempus.Components.ModuleRegistry
{
public class CommandModule : Module
{
// public required SeqConfiguration SeqConfiguration { get; set; }
protected override void Load(ContainerBuilder builder)
{
// Registrer alle handlers
builder.RegisterAssemblyTypes()
.AsClosedTypesOf(typeof(ICommandHandler<>))
.InstancePerLifetimeScope();
// Registrer en decorator for alle ICommandHandler<TCommand>
builder.RegisterGenericDecorator(
typeof(CreateUserHandlerDecorator<>), // Din decorator-klasse
typeof(ICommandHandler<>)); // Interface, der skal dekoreres
}
}
}