Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserCreatedEventHandler" /> class.
        /// </summary>
        /// <param name="mapper">event stream mapper instance.</param>
        /// <param name="eventRepository">event stream repository instance.</param>
        /// <param name="userRepository">user repository instance.</param>
        public UserCreatedEventHandler(
            IEventToEventStreamMapper <UserCreatedEvent> mapper,
            IBaseRepository <EventStream> eventRepository,
            IBaseRepository <User> userRepository)
        {
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            this._mapper = mapper;

            if (eventRepository == null)
            {
                throw new ArgumentNullException(nameof(eventRepository));
            }

            this._eventRepository = eventRepository;

            if (userRepository == null)
            {
                throw new ArgumentNullException(nameof(userRepository));
            }

            this._userRepository = userRepository;

            this._eventType = typeof(UserCreatedEvent).FullName;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EventStreamCreatedEventHandler" /> class.
        /// </summary>
        /// <param name="mapper">event stream mapper instance.</param>
        /// <param name="repository">event stream repository instance.</param>
        public EventStreamCreatedEventHandler(IEventToEventStreamMapper <EventStreamCreatedEvent> mapper, IBaseRepository <EventStream> repository)
        {
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            this._mapper = mapper;

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            this._repository = repository;

            this._eventType = typeof(EventStreamCreatedEvent).FullName;
        }