private void ProcessCommand <TCommand>(TCommand command, bool asThreadedAction, bool noUnitOfWork) { if (asThreadedAction) { ThreadLauncher.Launch(() => ExecuteCommand(command, noUnitOfWork)); } else { ExecuteCommand(command, noUnitOfWork); } }
//Raises the given domain event in its own thread public static void RaiseThreadedEvent <T>(T args) { if (Container != null) { foreach (var handler in Container.GetServices <ICommandHandler <T> >()) { ICommandHandler <T> threadHandler = handler; ThreadLauncher.Launch(threadHandler.Execute, args); } } if (_actions != null) { foreach (var action in _actions.OfType <Action <T> >()) { var threadHandler = action; ThreadLauncher.Launch(threadHandler, args); } } }