本文整理汇总了C#中System.Web.Mvc.ResultExecutedContext类的典型用法代码示例。如果您正苦于以下问题:C# ResultExecutedContext类的具体用法?C# ResultExecutedContext怎么用?C# ResultExecutedContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultExecutedContext类属于System.Web.Mvc命名空间,在下文中一共展示了ResultExecutedContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Reset
public static void Reset()
{
LastRequestData.ActionExecutedContext = null;
LastRequestData.ResultExecutedContext = null;
LastRequestData.HttpSessionState = null;
LastRequestData.Response = null;
}
开发者ID:Steji,项目名称:MvcIntegrationTestFramework,代码行数:7,代码来源:LastRequestData.cs
示例17: OnResultExecuted
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
if (filterContext.Exception != null)
{
filterContext.HttpContext.Response.Filter = null;
}
}
开发者ID:helloworld89,项目名称:RazorViewCompress,代码行数:7,代码来源:HtmlCompressFilter.cs
示例18: OnResultExecuted
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
base.OnResultExecuted(filterContext);
var infoObject = (InfoObject)filterContext.RequestContext.HttpContext.Request.RequestContext.RouteData.DataTokens[profile];
infoObject.ResultExecuted = (int)((Stopwatch)filterContext.RequestContext.HttpContext.Request.RequestContext.RouteData.DataTokens[stopwatch]).ElapsedMilliseconds;
_bag.Add(infoObject);
}
开发者ID:dnmsk,项目名称:rProject,代码行数:7,代码来源:ActionProfileAttribute.cs
示例19: OnResultExecuted
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
var controller = filterContext.Controller as SessionController;
if( controller==null )
{
return;
}
using(var session = controller.Session)
{
if( session==null )
{
return;
}
using(var transaction = session.Transaction)
{
if( transaction==null || !transaction.IsActive )
{
return;
}
if( filterContext.Exception!=null )
{
transaction.Rollback();
}
else
{
transaction.Commit();
}
transaction.Dispose();
}
}
}
开发者ID:thofisch,项目名称:Estime,代码行数:34,代码来源:SessionActionFilterAttribute.cs
示例20: 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();
if (!filterContext.HttpContext.User.Identity.IsAuthenticated && page.EnabledCache)
{
var outputTextWriterWrapper = filterContext.HttpContext.Response.Output as OutputTextWriterWrapper;
if (outputTextWriterWrapper != null
&& filterContext.Exception == null
&& filterContext.HttpContext.Response.ContentType.ToLower().Contains("text/html"))
{
var cacheKey = GetOutputCacheKey(filterContext.HttpContext, page);
if (outputTextWriterWrapper != null && site.ObjectCache().Get(cacheKey) == null)
{
site.ObjectCache().Add(cacheKey, outputTextWriterWrapper.ToString(), page.AsActual().OutputCache.ToCachePolicy());
}
}
}
}
#if Page_Trace
stopwatch.Stop();
filterContext.HttpContext.Response.Write(string.Format("OutputCacheFilterAttribute.OnResultExecuted, {0}ms.</br>", stopwatch.ElapsedMilliseconds));
#endif
}
开发者ID:Rufius,项目名称:CMS,代码行数:34,代码来源:OutputCacheFilterAttribute.cs
注:本文中的System.Web.Mvc.ResultExecutedContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论