Created
September 18, 2015 11:31
-
-
Save alanmac/f8f1c81057a1af90c66d to your computer and use it in GitHub Desktop.
This is a DonutOutputCache attribute extension that checks for use of Umbraco Doc Type Grid Editor. It's useful in the backoffice if Donut Output Caching is being used and it is throwing exceptions trying to cache DTGE in the backoffice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Used to stop Donut Caching from executing on the request if the Doc Type Grid Editor is being used in the backoffice | |
/// Put this attribute on the Controller/Method that is causing a problem in the backoffice. | |
/// e.g. [UmbracoDonutOutputCacheAttribute(CacheProfile = "FiveMin")] | |
// public ActionResult Home() | |
/// </summary> | |
public class UmbracoDonutOutputCacheAttribute : DonutOutputCacheAttribute | |
{ | |
public override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
if (filterContext.HttpContext.Request != null && filterContext.HttpContext.Request.QueryString != null | |
&& filterContext.HttpContext.Request.QueryString["dtgePreview"] != null) | |
{ | |
return; | |
} | |
base.OnActionExecuting(filterContext); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment