Exemplo n.º 1
0
        public static void SpringEventSafely <T1>(IAgileLogger agileLogger, string eventPath, Delegate theEvent, T1 t1)
        {
            if (theEvent == null)
            {
                return;
            }

            foreach (var invocation in theEvent.GetInvocationList())
            {
                try
                {
                    var cb = (Action <T1>)invocation;
                    cb(t1);
                }
                catch (Exception ee)
                {
                    while (ee.InnerException != null)
                    {
                        ee = ee.InnerException;
                    }
                    agileLogger.Log(ee,
                                    string.Format("{0} On handle event [{1}].", ReflectionUtil.GetMethodFullName(invocation.Method),
                                                  eventPath), ErrorLevel.Standard);
                }
            }
        }