ICanSendCommandExtension.cs 638 B

12345678910111213141516171819202122
  1. namespace Blue
  2. {
  3. public static class ICanSendCommandExtension
  4. {
  5. private static ICommandHandler _commandHandler;
  6. public static void SetCommandHandler(ICommandHandler commandHandler)
  7. {
  8. _commandHandler = commandHandler;
  9. }
  10. public static void SendCommand<T>(this ICanSendCommand self) where T : ICommand, new()
  11. {
  12. _commandHandler.ExcuteCommand<T>();
  13. }
  14. public static void SendCommand<T>(this ICanSendCommand self, T command) where T : ICommand
  15. {
  16. _commandHandler.ExcuteCommand(command);
  17. }
  18. }
  19. }