I have got the following interface definition:
public interface ICommandHandler
{
ILogger Logger { get; set; }
bool SendAsync { get; set; }
}
I have multiple implementations that implement ICommandHandler
and need to be resolved. While Castle Windows automatically injects the Logger
property, when an ILogger
is injected, I can't find a way to configure the SendAsync
property to be set to true by Windsor during the creation of new instances.
UPDATE
The command handlers implement a generic interface that inherits from the base interface:
public interface ICommandHandler<TCommand> : ICommandHandler
where TCommand : Command
{
void Handle(TCommand command);
}
Here is my configuration:
var container = new WindsorContainer();
container.Register(Component
.For<ICommandHandler<CustomerMovedCommand>>()
.ImplementedBy<CustomerMovedHandler>());
container.Register(Component
.For<ICommandHandler<ProcessOrderCommand>>()
.ImplementedBy<ProcessOrderHandler>());
container.Register(Component
.For<ICommandHandler<CustomerLeftCommand>>()
.ImplementedBy<CustomerLeftHandler>());
What ways are there to do this with Castle Windsor?