I'm looking for a very simple (at first sight) CommandBus, which will handle some ICommand publication. The CommandBus implementation will find the appropriate IHandler to Execute the Command and then Notify some possible IObservers.My first step is to make it work, I've chosen to use a synchronous dependency injection pattern which I may extends in the future, maybe using a real ServiceBus with some asynchronous capability.Here is the abstract definition:public interface ICommandBus{    TResult Publish<TCommand, TResult>(TCommand command)        where TResult : ICommandResult        where TCommand : ICommand<TResult>;}public interface ICommand<T>    where T : ICommandResult{    int Id_User { get; }}public interface ICommandResult{    bool Success { get; }    Exception Error { get; }    ICollection<ValidationRule> BrokenRules { get; }}public interface ICommandHandler<TCommand, TResult>    where TCommand : ICommand<TResult>    where TResult : ICommandResult{    TResult Execute(TCommand command);}public interface ICommandObserver<TCommand, TResult>    where TCommand : ICommand<TResult>    where TResult : ICommandResult{    void Trigger(TCommand command, TResult result);}And here is the CommandBus implementation (using Structuremap as the DI)public class CommandBus : ICommandBus{    private readonly IContainer m_container;    public CommandBus(IContainer container)    {        m_container = container;    }    public TResult Publish<TCommand, TResult>(TCommand command)        where TResult : ICommandResult        where TCommand : ICommand<TResult>    {        using (MiniProfiler.Current.Step(CommandBus.Publish))        {            var handler = m_container.GetInstance<ICommandHandler<TCommand, TResult>>();            var observers = m_container.GetAllInstances<ICommandObserver<TCommand, TResult>>();            var result = handler.Execute(command);            foreach (var observer in observers)                observer.Trigger(command, result);            return result;        }    }}How to use:public class CreateItemCommand: ICommand<CreateItemResult>{    public string Name { get; private set; }}public class CreateItemResult: ICommandResult{    public bool Success { get; private set; }}var command = new CreateItemCommand();var result = commandBus.Publish<CreateItemCommand, CreateItemResult>(command);What do you think about this pattern? Do you think it will be easy to upgrade? I'm afraid it can be an obvious bottleneck in my application...Edit: I just want to past a link to my question about this pattern, in order to simplify all the Generics...
CommandBus with Handlers & Observers
c#;dependency injection