Exemplo n.º 1
0
        public sealed override void OnExit(MethodExecutionArgs args)
        {
            if (!OldContextSynchronizationSwitch.Enabled)
            {
                Console.WriteLine("OldContextSynchronization not enabled.");
                return;
            }

            if (args.Exception != null)
            {
                Console.WriteLine("Method exited in error state.");
                return;
            }

            try
            {
                if (args.Instance == null)
                {
                    throw new Exception("SynchronizeOldContext requires method to belong to an object instance.");
                }

                if (args.ReturnValue == null)
                {
                    throw new Exception("SynchronizeOldContext requires method return value.");
                }

                ExecuteByConvention(_newContextMethod, args);
            }
            catch (Exception ex)
            {
                KillSwitch.Engage();
                var synchronizeException = new SynchronizeOldContextException(args, ex);
                Console.WriteLine(synchronizeException.Message);
                throw synchronizeException;
            }
        }
Exemplo n.º 2
0
 public virtual ActionResult ShutDown(ShutDownModel values)
 {
     KillSwitch.Engage();
     return(RedirectToAction(MVC.Home.SiteStatus()));
 }