예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actions"></param>
        public void Work(params Action[] actions)
        {
            ArgumentAssertion.IsNotNull(actions, "actions");

            lock (locker)
            {
                foreach (var action in actions)
                {
                    action();
                }
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static string GetFullPath(string filePath)
        {
            ArgumentAssertion.IsNotNull(filePath, "filePath");

            if (filePath.IndexOf(@":\\") != -1)
            {
                return(filePath);
            }
            else
            {
                return(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filePath));
            }
        }
예제 #3
0
        public static bool Handle(this Action action, string policyName, IDictionary bizInfo)
        {
            ArgumentAssertion.IsNotNull(action, "action");

            try
            {
                action();
                return(false);
            }
            catch (Exception ex)
            {
                return(ex.HandleException(policyName, bizInfo));
            }
        }
예제 #4
0
        public static bool HandleException(this Exception source, string policyName, IDictionary bizInfo, out Exception exceptionToThrow)
        {
            ArgumentAssertion.IsNotNull(source, "source");

            try
            {
                bool retrowAdviced = source.HandleException(policyName, bizInfo);
                exceptionToThrow = null;

                return(retrowAdviced);
            }
            catch (Exception exception)
            {
                exceptionToThrow = exception;
                return(true);
            }
        }