/// <summary> /// Registers an IDomainListener that will be listening to a DomainEvent. /// <para> /// Exceptions: /// Throws ArgumentNullException if a null IDomainListener is added. /// Throws DuplicatedDomainListenerException if a duplicated IDomainListener is added. /// </para> /// </summary> /// <param name="listener">Listener that will be registered. Cannot be Null.</param> public void AddListener(IDomainListener listener) { if (listener == null) { throw new ArgumentNullException("IDomainListener is required."); } if (!domainListeners.Add(new DomainListenerDecorator(listener))) { throw new DuplicatedDomainListenerException(listener.GetType()); } }
public DomainListenerDecorator(IDomainListener domainListener) { this.listener = domainListener; }