Beispiel #1
0
        /// <summary>
        /// Static constructor.
        /// </summary>
        static PerformanceMeterController()
        {
            // set cache time for PerformanceMeterController class
            PerformanceMeter <PerformanceMeterController> .SetMethodCallsCacheTime(5);

            // add common custom data (string) to class performance information
            PerformanceMeter <PerformanceMeterController> .AddCustomData("Tag", "CustomTag");

            // add common custom data (anonymous class) to class performance information
            PerformanceMeter <PerformanceMeterController> .AddCustomData("Custom anonymous class", new { Name = "Custom Name", Value = 1 });

            // set default exception handler for PerformanceMeterController class
            PerformanceMeter <PerformanceMeterController> .SetDefaultExceptionHandler((ex) => Debug.WriteLine(ex.Message));
        }
        /// <summary>
        /// Set the time in minutes to clear collection of the method calls.
        /// </summary>
        /// <typeparam name="TClass">Type of the controller.</typeparam>
        /// <param name="options">The options.</param>
        /// <param name="minutes">Time in minutes to clear list of the method calls.</param>
        /// <returns>
        /// Returns <see cref="PerformanceMeterMvcOptions{TClass}"/>.
        /// </returns>
        public static PerformanceMeterMvcOptions <TClass> SetMethodCallsCacheTime <TClass>(this PerformanceMeterMvcOptions <TClass> options, int minutes) where TClass : ControllerBase
        {
            PerformanceMeter <TClass> .SetMethodCallsCacheTime(minutes);

            return(options);
        }