PlanTempusApp/PlanTempus.Components/ModuleRegistry/CommandModule.cs

24 lines
No EOL
766 B
C#

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
}
}
}