PlanTempusApp/PlanTempus.Components/ModuleRegistry/CommandModule.cs

24 lines
766 B
C#
Raw Normal View History

2025-03-10 15:56:22 +01:00
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(
2025-03-10 18:10:00 +01:00
typeof(CreateUserHandlerDecorator<>), // Din decorator-klasse
2025-03-10 15:56:22 +01:00
typeof(ICommandHandler<>)); // Interface, der skal dekoreres
}
}
}