37 lines
No EOL
1.3 KiB
C#
37 lines
No EOL
1.3 KiB
C#
using Autofac;
|
|
using PlanTempus.Components.Users.Create;
|
|
using PlanTempus.Core.CommandQueries;
|
|
using PlanTempus.Core.SeqLogging;
|
|
|
|
namespace PlanTempus.Components.ModuleRegistry
|
|
{
|
|
public class CommandModule : Module
|
|
{
|
|
// public required SeqConfiguration SeqConfiguration { get; set; }
|
|
|
|
protected override void Load(ContainerBuilder builder)
|
|
{
|
|
builder.RegisterType<PlanTempus.Components.CommandHandler>()
|
|
.As<PlanTempus.Components.ICommandHandler>()
|
|
.InstancePerLifetimeScope();
|
|
|
|
builder.RegisterAssemblyTypes(ThisAssembly)
|
|
.Where(t => !typeof(ICommandHandlerDecorator).IsAssignableFrom(t))
|
|
.AsClosedTypesOf(typeof(ICommandHandler<>))
|
|
.InstancePerLifetimeScope();
|
|
|
|
builder.RegisterAssemblyTypes(ThisAssembly)
|
|
.As<ICommandHandlerDecorator>();
|
|
|
|
|
|
builder.RegisterGenericDecorator(
|
|
typeof(CommandHandlerDecorator<>),
|
|
typeof(ICommandHandler<>));
|
|
//
|
|
// Registrer en decorator for alle ICommandHandler<TCommand>
|
|
// builder.RegisterGenericDecorator(
|
|
// typeof(CommandHandlerDecorator<,>),
|
|
// typeof(ICommandHandler<,>));
|
|
}
|
|
}
|
|
} |