ShortBus

by mhinze

mhinze / ShortBus

In-process mediator with low-friction API

206 Stars 40 Forks Last release: Not found MIT License 58 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

ShortBus

ShortBus is an in-process mediator with low-friction API

Command

public class DoSomething : ICommand { }

public class DoesSomething : ICommandHandler { public void Handle(DoSomething command) { // does something } }

_mediator.Send(new DoSomething());

Query

public class AskAQuestion : IQuery { }

public class Answerer : IQueryHandler { public Answer Handle(AskAQuestion query) {
return answer; } }

var answer = _mediator.Request(new AskAQuestion());

IOC Containers

ShortBus currently supports 6 IOC containers

  • AutoFac
  • Ninject
  • Simple Injector
  • Structure Map
  • Unity
  • Windsor

Example configuration of registering handlers using StructureMap:

ObjectFactory.Initialize(i => i.Scan(s =>
{
    s.AssemblyContainingType();
    s.TheCallingAssembly();
    s.WithDefaultConventions();
    s.AddAllTypesOf(typeof (IQueryHandler));
    s.AddAllTypesOf(typeof (ICommandHandler<>));
}));    

Low-friction API

No type parameter noise.

What for?

  • Query objects
  • Enables subcutaneous testing
  • Business concepts as first class citizens

In Production

ShortBus is in production powering the server APIs for major ecommerce applications.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.