當前位置: 首頁>>代碼示例>>C#>>正文


C# Mvc.ResultExecutedContext類代碼示例

本文整理匯總了C#中System.Web.Mvc.ResultExecutedContext的典型用法代碼示例。如果您正苦於以下問題:C# ResultExecutedContext類的具體用法?C# ResultExecutedContext怎麽用?C# ResultExecutedContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResultExecutedContext類屬於System.Web.Mvc命名空間,在下文中一共展示了ResultExecutedContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnResultExecuted

 public override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     MonitorLog MonLog = filterContext.Controller.ViewData[Key] as MonitorLog;
     MonLog.ExecuteEndTime = DateTime.Now;
     LoggerHelper.Monitor(MonLog.GetLoginfo(MonitorLog.MonitorType.View));
     filterContext.Controller.ViewData.Remove(Key);
 }
開發者ID:wfguanhan,項目名稱:CDMIS,代碼行數:7,代碼來源:StatisticsTrackerAttribute.cs

示例2: OnResultExecuted

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //We might want to close sessions even if we aren't delegated transaction support
            if (_delegateTransactionSupport) return;

            _dbContext.CloseSession();
        }
開發者ID:ucdavis,項目名稱:UCDArch,代碼行數:7,代碼來源:UseTransactionsByDefaultAttribute.cs

示例3: OnResultExecuted

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            string effectiveFactoryKey = GetEffectiveFactoryKey();

            ITransaction currentTransaction =
                NHibernateSession.CurrentFor(effectiveFactoryKey).Transaction;

            base.OnResultExecuted(filterContext);
            try
            {
                if (currentTransaction.IsActive) {
                    if ((filterContext.Exception != null) && (!filterContext.ExceptionHandled))
                    {
                        currentTransaction.Rollback();
                    }
                    else
                    {
                        currentTransaction.Commit();
                    }
                }
            }
            finally
            {
                currentTransaction.Dispose();
            }
        }
開發者ID:bondehagen,項目名稱:Sharp-Architecture,代碼行數:26,代碼來源:TransactionAttribute.cs

示例4: OnResultExecuted

 /// <summary>
 /// Ensures that the controller is of the required type, if so lets execution continue on the base class
 /// </summary>
 /// <param name="filterContext"></param>
 public override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     var backOfficeController = GetController(filterContext.Controller);
     if (!backOfficeController.Notifications.Any())
         return;
     base.OnResultExecuted(filterContext);
 }
開發者ID:paulsuart,項目名稱:rebelcmsxu5,代碼行數:11,代碼來源:SupportsClientNotificationsAttribute.cs

示例5: OnResultExecuted

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            base.OnResultExecuted(filterContext);
            #if Page_Trace
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            #endif
            if (Page_Context.Current.PageRequestContext != null)
            {

                var site = Page_Context.Current.PageRequestContext.Site;
                var page = Page_Context.Current.PageRequestContext.Page.AsActual();

                var outputTextWriterWrapper = filterContext.HttpContext.Response.Output as OutputTextWriterWrapper;
                if (outputTextWriterWrapper != null
                    && !(filterContext.Result is CachedContentResult)
                    && filterContext.Exception == null
                    && filterContext.HttpContext.Response.ContentType.ToLower().Contains("text/html"))
                {
                    var html = outputTextWriterWrapper.ToString();
                    var htmlParser = Kooboo.CMS.Common.Runtime.EngineContext.Current.TryResolve<IHtmlParser>();
                    if (htmlParser != null)
                    {
                        html = htmlParser.Parse(html);
                        outputTextWriterWrapper.Flush();
                        outputTextWriterWrapper.Write(html);
                    }
                }
            }

            #if Page_Trace
            stopwatch.Stop();
            filterContext.HttpContext.Response.Write(string.Format("PageHtmlParserActionFilter.OnResultExecuted, {0}ms.</br>", stopwatch.ElapsedMilliseconds));
            #endif
        }
開發者ID:jason1234,項目名稱:CMS,代碼行數:35,代碼來源:PageHtmlParserActionFilter.cs

示例6: Should_delegate_to_result_filter_executed

		public void Should_delegate_to_result_filter_executed()
		{
			var attribute = new FilterUsingAttribute(typeof(TestResultFilter));
			var context = new ResultExecutedContext();
			attribute.OnResultExecuted(context);
			context.Result.ShouldBe<EmptyResult>();
		}
開發者ID:somlea-george,項目名稱:sutekishop,代碼行數:7,代碼來源:FilterUsingAttributeTester.cs

示例7: OnResultExecuted

        protected override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            if (_resultExecutingToExecuted != null)
                _resultExecutingToExecuted.Dispose();

            base.OnResultExecuted(filterContext);
        }
開發者ID:shaileshpandey,項目名稱:MiniProfiler,代碼行數:7,代碼來源:BaseController.cs

示例8: OnResultExecuted

        /// <summary>
        /// Called by the ASP.NET MVC framework after the action result executes.
        /// </summary>
        /// <param name="filterContext">The filter context.</param>
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            base.OnResultExecuted(filterContext);

            AdminBaseController.CurrentEnvironment = null;
            AdminBaseController.CurrentController = null;
        }
開發者ID:rynnwang,項目名稱:CommonSolution,代碼行數:11,代碼來源:EnvironmentBasedAttribute.cs

示例9: OnResultExecuted

 public override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     string contentType = filterContext.HttpContext.Response.ContentType;
     if (contentType == "application/json")
         filterContext.HttpContext.Response.ContentType = "text/html";
     base.OnResultExecuted(filterContext);
 }
開發者ID:peisheng,項目名稱:datacenter,代碼行數:7,代碼來源:JsonAttribute.cs

示例10: OnResultExecuted

 protected override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     timer.Stop();
     filterContext.HttpContext.Response.Write(
         string.Format("<div>Total elapsed time: {0}</div>",
         timer.Elapsed.TotalSeconds));
 }
開發者ID:tonousa,項目名稱:Filters,代碼行數:7,代碼來源:HomeController.cs

示例11: OnResultExecuted

 public override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     timer.Stop();
     filterContext.HttpContext.Response.Write(
         string.Format("Action result elapsed time: {0}",
             timer.Elapsed.TotalSeconds));
 }
開發者ID:akhuang,項目名稱:Books-SourceCode,代碼行數:7,代碼來源:ProfileAllAttribute.cs

示例12: OnResultExecuted

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            base.OnResultExecuted(filterContext);

            if (!IsEnable)
                return;

            if (filterContext.IsChildAction)
                return;

            if (filterContext.Exception != null || filterContext.HttpContext.Error != null)
                return;

            HttpRequestBase request = filterContext.HttpContext.Request;
            string acceptEncoding = request.Headers["Accept-Encoding"];
            if (string.IsNullOrEmpty(acceptEncoding))
                return;

            acceptEncoding = acceptEncoding.ToUpperInvariant();
            HttpResponseBase response = filterContext.HttpContext.Response;

            //if (response.IsRequestBeingRedirected)
            //    return;

            if (acceptEncoding.Contains("GZIP"))
            {
                response.AppendHeader("Content-encoding", "gzip");
                response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
            }
            else if (acceptEncoding.Contains("DEFLATE"))
            {
                response.AppendHeader("Content-encoding", "deflate");
                response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
            }
        }
開發者ID:ClaytonWang,項目名稱:Dw3cSNS,代碼行數:35,代碼來源:HttpCompressAttribute.cs

示例13: OnResultExecuted

        public override void OnResultExecuted(ResultExecutedContext context)
        {
            var resultType = context.Result.GetType().Name;
            LogManager.GetLogger("").Info("ResultExecuted: " + context.Controller + " ⇒ " + resultType);

            base.OnResultExecuted(context);
        }
開發者ID:scott-xu,項目名稱:log4net.SignalR,代碼行數:7,代碼來源:LogActionFilterAttribute.cs

示例14: OnResultExecuted

        public void OnResultExecuted(ResultExecutedContext filterContext)
        {
            foreach (var sitePart in _orchardServices.WorkContext.CurrentSite.ContentItem.Parts)
            {
                foreach (var property in sitePart.GetType().GetProperties().Where(p=>p.Name!="Id"))//id will always be 1 because this part is bound to the site
                {
                    try {
                        var propertyType = property.PropertyType;
                        // Supported types (we also know they are not indexed properties).
                        if ((propertyType == typeof (string) || propertyType == typeof (bool) || propertyType == typeof (int))
                            && property.CanRead) {
                            var value = property.GetValue(sitePart, null);

                            _performanceMonitor.PublishMessage(new SiteSettingsMessage {
                                Part = sitePart.PartDefinition.Name,
                                Name = property.Name,
                                Value = value
                            });
                        }
                    }
                    catch (Exception ex) {
                        //todo: figure out why this occaisionally fails
                    }
                }
            }
        }
開發者ID:arheom,項目名稱:Glimpse.Orchard,代碼行數:26,代碼來源:SiteSettingsFilter.cs

示例15: OnResultExecuted

 public override void OnResultExecuted(ResultExecutedContext filterContext)
 {
     base.OnResultExecuted(filterContext);
     if (Page_Context.Current.PageRequestContext != null)
     {
         var site = Page_Context.Current.PageRequestContext.Site;
         var page = Page_Context.Current.PageRequestContext.Page.AsActual();
         if (!filterContext.HttpContext.Request.IsAjaxRequest() && !filterContext.HttpContext.User.Identity.IsAuthenticated && page.CacheToDisk)
         {
             var outputTextWriterWrapper = filterContext.HttpContext.Response.Output as OutputTextWriterWrapper;
             if (outputTextWriterWrapper != null
                 && filterContext.Exception == null
                 && filterContext.HttpContext.Response.ContentType.ToLower().Contains("text/html"))
             {
                 try
                 {
                     var html = outputTextWriterWrapper.ToString();
                     PageCachingManager.AddCaching(filterContext.HttpContext, page, html);
                 }
                 catch (Exception e)
                 {
                     Kooboo.HealthMonitoring.Log.LogException(e);
                 }
             }
         }
     }
 }
開發者ID:Godoy,項目名稱:CMS,代碼行數:27,代碼來源:CacheToDiskAttribute.cs


注:本文中的System.Web.Mvc.ResultExecutedContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。