当前位置: 首页>>代码示例>>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;未经允许,请勿转载。