Exemple #1
0
        /// <summary>
        /// Events object from the object passed to this method gets added to collection of Events collections.
        /// These recursive collections allow building a hierarchical tree of Events for later reporting by the top caller object.
        /// The method updates properties of the Events object with properties of the passed host object, so that the host did not have to do it itself.
        /// </summary>
        /// <param name="objectWithEvents">Object to take Events and other properties from.</param>
        public void AddObjectEvents(IEventsCollector objectWithEvents)
        {
            Events EventsOfPassedObject = objectWithEvents.Events;

            //We could set these properties in constructor, but most likely they are not initialized at the time, and we need to do it for every object.
            //We could do that when Add method is called to add a single event, but too many calls to use extra parameter
            if (EventsOfPassedObject.Exist)            //otherwise we may end up with adding empty object, and we do not want that
            {
                EventsOfPassedObject.OwnerObjectId = objectWithEvents.Id;
                EventsOfPassedObject.OwnerObjectNameForReporting = objectWithEvents.ObjectNameForReporting;
                _DownstreamEventsCollections.Add(EventsOfPassedObject);
                _blnEventsExist = true;
                if (EventsOfPassedObject._blnErrorsExist)
                {
                    _blnErrorsExist = true;                  //Otherwise do not touch it
                }
                enuSuccessStatus Status = EventsOfPassedObject.GetSuccessStatus(objectWithEvents.Transactional);
                _blnAnySuccess = (Status != enuSuccessStatus.Failed);
            }
        }
		/// <summary>
		/// Events object from the object passed to this method gets added to collection of Events collections.
		/// These recursive collections allow building a hierarchical tree of Events for later reporting by the top caller object.
		/// The method updates properties of the Events object with properties of the passed host object, so that the host did not have to do it itself.
		/// </summary>
		/// <param name="objectWithEvents">Object to take Events and other properties from.</param>
		public void AddObjectEvents(IEventsCollector objectWithEvents) {
			Events EventsOfPassedObject=objectWithEvents.Events;
			//We could set these properties in constructor, but most likely they are not initialized at the time, and we need to do it for every object.
			//We could do that when Add method is called to add a single event, but too many calls to use extra parameter
			if(EventsOfPassedObject.Exist){//otherwise we may end up with adding empty object, and we do not want that
				EventsOfPassedObject.OwnerObjectId=objectWithEvents.Id;
				EventsOfPassedObject.OwnerObjectNameForReporting=objectWithEvents.ObjectNameForReporting;
				_DownstreamEventsCollections.Add(EventsOfPassedObject);
				_blnEventsExist=true;
				if(EventsOfPassedObject._blnErrorsExist) {
					_blnErrorsExist=true;//Otherwise do not touch it
				}
				enuSuccessStatus Status=EventsOfPassedObject.GetSuccessStatus(objectWithEvents.Transactional);
				_blnAnySuccess=(Status!=enuSuccessStatus.Failed);
			}
		}
Exemple #3
0
 public EventsProcessor(IEventsCollector <T> collector, IEventHandler <T> handler, ILog logger)
 {
     _collector = collector;
     _handler   = handler;
     _logger    = logger;
 }