I need decorate all based onICommandHandler types using a corresponding DeadlockRetryCommandHandlerDecorator type
I tried
I had the same issue. I managed to resolve it by registering each type explicity as more specific type. For me this solution is more clear than using sub dependency resolver
var commandTypes = businessAssembly.GetTypes()
.Where(t => !t.IsInterface && typeof(ICommand).IsAssignableFrom(t));
foreach(var commandType in commandTypes)
{
var handlerInterface = typeof(ICommandHandler<>).MakeGenericType(new[] { commandType });
var transactionalHandler = typeof(DeadlockRetryCommandHandlerDecorator<>).MakeGenericType(new[] { commandType });
container.Register(Component.For(handlerInterface)
.ImplementedBy(transactionalHandler)
.LifeStyle.PerWebRequest);
}