Ejemplo n.º 1
0
 public static TResult Execute <TResult>(this ApmMethodHandlerBase apmMethodHandlerBase, Func <TResult> func)
 {
     apmMethodHandlerBase.OnActionExecuting();
     try
     {
         return(func());
     }
     finally
     {
         apmMethodHandlerBase.OnActionExecuted();
     }
 }
Ejemplo n.º 2
0
 public static void Execute(this ApmMethodHandlerBase apmMethodHandlerBase, Action action)
 {
     apmMethodHandlerBase.OnActionExecuting();
     try
     {
         action();
     }
     finally
     {
         apmMethodHandlerBase.OnActionExecuted();
     }
 }
        public static ApmMethodHandlerBase GetMethodHander(this IApmContext apmContext)
        {
            if (!ApmMethodHttpFactories.Any())
            {
                return(null);
            }

            ApmMethodHandlerBase apmMethodHandler = null;

            foreach (var apmMethodHttpFactory in ApmMethodHttpFactories)
            {
                var currentApmMethod = apmMethodHttpFactory.Create(apmContext);
                if (apmMethodHandler != null)
                {
                    currentApmMethod.InnerHandler = apmMethodHandler;
                }

                apmMethodHandler = currentApmMethod;
            }

            return(apmMethodHandler);
        }