Q:

Why doesn't Windsor resolve every decorator I register?

I have a class that I would like to decorate twice. However, when I resolve this class Windsor only decorates it once instead of using my 2 decorators. I'm not sure why this is the case because I registered both decorators before the class I'm resolving, which is how I understand decorators to work with Windsor.
Here is my code.
public interface IQueryExecuter
{
    TReturn Execute<TReturn>(IQuery<TReturn> query);
}

public class QueryLoggingDecorator : IQueryExecuter
{
    private ILogger _logger = NullLogger.Instance;

    public ILogger Logger
    {
        set { _logger = value; }
    }

    public TReturn Execute<TReturn>(IQuery<TReturn> query)
    {
        _logger.Info("Before query execute");
        var queryResults = query.Execute();
        _logger.Info("After query execute");

        return queryResults;
    }
}

public class QueryTransactionDecorator : IQueryExecuter
{
    public TReturn Execute<TReturn>(IQuery<TReturn> query)
    {
        try
        {
            Console.WriteLine("Beginning transaction");
            var queryResults = query.Execute();
            Console.WriteLine("Comitting transaction");

            return queryResults;
        }
        catch (Exception)
        {
            Console.WriteLine("Rolling back transaction");
            throw;
        }
    }
}

public interface IQuery<out TReturn>
{
    TReturn Execute();
}

public class Query : IQuery<string>
{
    public string Execute()
    {
        Console.WriteLine("Executing query");

        var queryResults = Path.GetRandomFileName();

        return queryResults;
    }
}

And here is my Windsor registration code.
public class DefaultInstaller : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.Register(Component
            .For<IQueryExecuter>()
            .ImplementedBy<QueryLoggingDecorator>()
            .LifestyleTransient());
        container.Register(Component
            .For<IQueryExecuter>()
            .ImplementedBy<QueryTransactionDecorator>()
            .LifestyleTransient());
        container.Register(Component
            .For<IQueryExecuter>()
            .ImplementedBy<QueryExecuter>()
            .LifestyleTransient());
    }
}

And lastly, here is my calling code.
var container = new WindsorContainer();

container.Install(FromAssembly.This());

var queryExecuter = container.Resolve<IQueryExecuter>();
var queryResults = queryExecuter.Execute(new Query());

What am I missing?
I would expect that when I resolve IQueryExecuter that Windsor would decorate with QueryLoggingDecorator and then QueryTransactionDecorator.

A:

The problem is these aren't decorators; they're just different implementations of the same interface.  Decorators need something to actually decorate, which is an instance of the same interface they're implementing, so they can call the next decorator in the chain.
You need to set up an injectable reference to an IQueryExecuter.  After that, Windsor handles the rest, injecting the decorator chain in the registered order (at least, according to the documentation).
For example:
public class QueryLoggingDecorator : IQueryExecuter
{
    private ILogger _logger = NullLogger.Instance;
    private IQueryExecuter innerExecuter;

    public QueryLoggingDecorator(IQueryExecuter innerExecuter)
    {
        this.innerExecuter = innerExecuter;
    }

    public ILogger Logger
    {
        set { _logger = value; }
    }

    public TReturn Execute<TReturn>(IQuery<TReturn> query)
    {
        _logger.Info("Before query execute");
        var queryResults = innerExecuter.Execute(query);
        _logger.Info("After query execute");

        return queryResults;
    }
}

I will admit to not trying this out directly, but this blog indicated it would work.

