private void RegisterDefinedInterceptingMessages(InterceptorAgent interceptorAgent) { IEnumerable <InterceptsAttribute> attributes = interceptorAgent.GetType() .GetCustomAttributes(typeof(InterceptsAttribute), true) .OfType <InterceptsAttribute>(); foreach (InterceptsAttribute attribute in attributes) { publisher.RegisterInterceptor(attribute.MessageType, interceptorAgent); } }
public void RegisterInterceptor(Type trigger, InterceptorAgent agent) { if (trigger == typeof(Message)) { registeredMessageInterceptors.Add(agent); } if (!interceptorAgents.ContainsKey(trigger)) { interceptorAgents.Add(trigger, new List <InterceptorAgent>()); } interceptorAgents[trigger].Add(agent); }