/// <summary> /// Обрабатывает сообщение /// </summary> /// <param name="message">Сообщение</param> protected void ProcessMessage(Message message) { var actionExecutionContext = new ActionExecutionContext(this); var actionFactories = ServiceLocationContainer .ResolveAbsolutelyAll <IActionFactoryService>() .OrderByDescending(actf => Convert.ToInt32(actf.Priority)); actionExecutionContext.Run(); foreach (var actionFactory in actionFactories) { var action = actionFactory.Create(message); if (action == null) { continue; } if (!AllowExecute(actionExecutionContext.State, action)) { continue; } try { ExecuteAction(action, actionExecutionContext); } catch (Exception ex) { OnErrorOccured(this, new ErrorEventArgs(ex)); actionExecutionContext.Fault(); } finally { GC.Collect(); } } }
protected virtual void ExecuteAction(IAction action, ActionExecutionContext context) { action.Execute(context); }