Skip to content

Instantly share code, notes, and snippets.

@alanmac
Created September 18, 2015 11:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanmac/f8f1c81057a1af90c66d to your computer and use it in GitHub Desktop.
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
/// <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