Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 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);
 }