CodeSharp.EventSourcing.DefaultAggregateRootInternalHandlerProvider.RegisterInternalHandler C# (CSharp) Метод

RegisterInternalHandler() публичный Метод

public RegisterInternalHandler ( Type aggregateRootType, Type eventType, MethodInfo eventHandler ) : void
aggregateRootType System.Type
eventType System.Type
eventHandler System.Reflection.MethodInfo
Результат void
        public void RegisterInternalHandler(Type aggregateRootType, Type eventType, MethodInfo eventHandler)
        {
            IDictionary<Type, MethodInfo> eventHandlerDic;

            if (!_mappings.TryGetValue(aggregateRootType, out eventHandlerDic))
            {
                eventHandlerDic = new Dictionary<Type, MethodInfo>();
                _mappings.Add(aggregateRootType, eventHandlerDic);
            }

            if (eventHandlerDic.ContainsKey(eventType))
            {
                throw new EventSourcingException(string.Format("聚合根({0})上定义了重复的事件({1})响应函数。", aggregateRootType.FullName, eventType.FullName));
            }

            eventHandlerDic.Add(eventType, eventHandler);
        }