public void Subscribe <T, TInput>(Action <TInput> action) { // TODO make some attributes to filter action bus types such as MaxSubsubscribers Type type = typeof(T); if (m_actionMap.ContainsKey(type)) { m_actionMap[type].Add(action); } ActionList actionList = new ActionList(); actionList.Add(action); m_actionMap.Add(type, actionList); }
/// <summary> /// get action for /// </summary> /// <param name="theExpressionType">the expression type</param> /// <returns>the action for the exression type or throws <seealso cref="MalformedRequestException"/> for unknown types</returns> public Func <string, IScopeLoggingContext, Task <string> > GetActionFor(TypeOfExpression theExpressionType) => ActionMap.ContainsKey(theExpressionType) ? ActionMap[theExpressionType] : DefaultAction();