Adds Generic CommandHandlerDecorator
This commit is contained in:
parent
49f9b99ee1
commit
64e696dc5a
21 changed files with 131 additions and 110 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using Autofac;
|
||||
using PlanTempus.Components.Users.Create;
|
||||
using PlanTempus.Core.CommandQueries;
|
||||
using PlanTempus.Core.SeqLogging;
|
||||
|
||||
namespace PlanTempus.Components.ModuleRegistry
|
||||
|
|
@ -10,35 +11,27 @@ namespace PlanTempus.Components.ModuleRegistry
|
|||
|
||||
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();
|
||||
|
||||
|
||||
// Registrer alle handlers
|
||||
// builder.RegisterAssemblyTypes(ThisAssembly)
|
||||
// .AsClosedTypesOf(typeof(ICommandHandler<,>))
|
||||
// .InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterAssemblyTypes(ThisAssembly)
|
||||
.As<ICommandHandlerDecorator>();
|
||||
|
||||
|
||||
builder.RegisterDecorator(
|
||||
typeof(CreateUserHandlerDecorator),
|
||||
typeof(ICommandHandler<CreateUserCommand, CreateUserResult>));
|
||||
.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<,>));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue