예제 #1
0
    static Dispatcher GetDispatcherFor(IVisitableObject message)
    {
        Type type = message.GetType();

        if (!dispatchers.ContainsKey(type))
        {
            Type   closedType = typeof(Dispatcher <>).MakeGenericType(message.GetType());
            object dispatcher = Activator.CreateInstance(closedType);
            dispatchers[type] = (Dispatcher)dispatcher;
        }
        return(dispatchers[type]);
    }
예제 #2
0
 public abstract void Dispatch(IVisitableObject message, IEnumerable <object> subscribers);