Skip to content

Instantly share code, notes, and snippets.

@ashic
Created February 1, 2012 16:34
Show Gist options
  • Save ashic/1717892 to your computer and use it in GitHub Desktop.
Save ashic/1717892 to your computer and use it in GitHub Desktop.
public class SomeCommandHandler
{
public void Handle(SomeCommand command)
{
}
}
public class UoWWrapper
{
public UoWWrapper(Action<object> next)
{
_next = next;
}
public void Handle(object command)
{
var uow = new UoW()
{
_next(command);
uow.Commit();
}
}
}
public class CompositionRoot
{
public void Setup()
{
var bus = new Bus();
var someHandler = new SomeCommandHandler().Handle;
var wrapped = new UoWWrapper(someHandler).Handle;
bus.RegisterCommand<SomeCommand>(wrapped);
}
}
//Some widening - narrowing may be needed between Action<T> and Action<object> but that's trivial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment