Last active
June 2, 2017 11:52
-
-
Save bmeredith/99ec50eced67934a9670 to your computer and use it in GitHub Desktop.
This file contains 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 AutofacCommandDispatcher : ICommandDispatcher | |
{ | |
private readonly IComponentContext _context; | |
public AutofacCommandDispatcher(IComponentContext context) | |
{ | |
_context = context; | |
} | |
public void Dispatch(ICommand command) | |
{ | |
var handlerType = typeof(ICommandHandler<>).MakeGenericType(command.GetType()); | |
dynamic handler = _context.Resolve(handlerType); | |
handler.Handle((dynamic)command); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment