Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time


If you are looking for how to configure EventFlow, look at the :ref:`configuration <configuration>` documentation.

Whenever EventFlow doesn't meet your needs, e.g. if you want to collect statistics on each command execution time, you can customize EventFlow.

Basically EventFlow relies on an IoC container to allow developers to customize the different parts of EventFlow.

Note: Read the section "Changing IoC container" for details on how to change the IoC container used if you have specific needs like e.g. integrating EventFlow into an Owin application.

You have two options for when you want to customize EventFlow

  • Decorate an implementation
  • Replace an implementation

Decorating implementations

In the case of collecting statistics, you might want to wrap the existing ICommandBus with a decorator class that can collect statistics on command execution times.

void ConfigureEventFlow()
  var resolver =

void DecorateCommandBus(IServiceRegistration sr)
  sr.Decorate<ICommandBus>((r, cb) => new StatsCommandBus(cb));

class StatsCommandBus : ICommandBus
  private readonly ICommandBus _internalCommandBus;

  public StatsCommandBus(ICommandBus commandBus)
    _internalCommandBus = commandBus;

  // Here follow implementations of ICommandBus that call the
  // internal command bus and logs statistics

Registering new implementations

The more drastic step is to completely replace an implementation. For this you use the Register(...) and related methods on IServiceRegistration instead of the Decorate(...) method.