Created
February 1, 2012 16:34
-
-
Save ashic/1717892 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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