Created
February 1, 2012 16:34
Revisions
-
ashic created this gist
Feb 1, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ 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