Beispiel #1
0
        /// <summary>
        /// 生成方法
        /// </summary>
        /// <typeparam name="TEvent">事件类型</typeparam>
        /// <param name="e">事件</param>
        /// <param name="element">执行元素</param>
        public virtual void MakeEventHandlerInvoke <TEvent>(TEvent e, EventExcutingElement element) where TEvent : IEvent
        {
            foreach (var handler in element.HandlerFilters)
            {
                handler.OnActionExecuting(element.EventContext, e);
            }

            ((IEventHandler <TEvent>)element.EventHandler).Execute(element.EventContext, e);
        }
Beispiel #2
0
        /// <summary>
        /// 保存日志
        /// </summary>
        /// <typeparam name="TEvent">事件类型</typeparam>
        /// <param name="element">执行元素</param>
        /// <param name="e">事件</param>
        /// <param name="ex">异常</param>
        public void OnEventHandlerError <TEvent>(EventExcutingElement element, TEvent e, Exception ex) where TEvent : IEvent
        {
            if (element.LoggerAttribute == null)
            {
                return;
            }

            try
            {
                element.LoggerAttribute.OnError(element.EventContext, element.LoggerBuilder, element.EventHandlerType, ex, element.EventContext);
            }
            catch
            {
            }
            finally
            {
            }
        }
Beispiel #3
0
 /// <summary>
 /// 过滤执行元素
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 protected virtual bool ExcutingElementFilter(EventExcutingElement element)
 {
     return(true);
 }