Skip to content

Instantly share code, notes, and snippets.

View hhariri's full-sized avatar

Hadi Hariri hhariri

View GitHub Profile
public class AutoFilterActionInvoker: ControllerActionInvoker
{
protected override FilterInfo GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
var filters = base.GetFilters(controllerContext, actionDescriptor);
filters.ResultFilters.Add(new CustomBehaviorAttribute());
return filters;
}
{"issue":[{"@priority":"1","@type":"Task","@state":"Fixed","@subsystem":"No subsystem","@id":"DCVR-1","@fixedVersion":"","@projectShortName":"DCVR","@reporterName":"ruslan.isakiev","@fixedInBuild":"Next build","@commentsCount":"0","@numberInProject":"1","@summary":"Show coverage results in unit test runner's window","@created":"1256724558540","@updated":"1257780483529","@historyUpdated":"1257780483532","@resolved":"1257769772458","@votes":"0","links":null,"attachments":null},{"@priority":"1","@type":"Exception","@state":"Fixed","@subsystem":"Submitted exceptions","@id":"DCVR-2","@fixedVersion":"","@projectShortName":"DCVR","@reporterName":"ruslan.isakiev","@fixedInBuild":"Next build","@commentsCount":"0","@numberInProject":"2","@summary":"Exception : An exception has occurred during action 'OpenSnapshot' execution. Sample exception","@description":"dotCover 1.0 Version=1.0.0.0, Built=2009-11-02T12:21:25, Configuration=“Full PublicMode VS0900”\nAn exception has occurred during action 'OpenSnapshot' execution.
"{\"issue\":[{\"@priority\":\"1\",\"@type\":\"Task\",\"@state\":\"Fixed\",\"@subsystem\":\"No subsystem\",\"@id\":\"DCVR-1\",\"@fixedVersion\":\"\",\"@projectShortName\":\"DCVR\",\"@reporterName\":\"ruslan.isakiev\",\"@fixedInBuild\":\"Next build\",\"@commentsCount\":\"0\",\"@numberInProject\":\"1\",\"@summary\":\"Show coverage results in unit test runner's window\",\"@created\":\"1256724558540\",\"@updated\":\"1257780483529\",\"@historyUpdated\":\"1257780483532\",\"@resolved\":\"1257769772458\",\"@votes\":\"0\",\"links\":null,\"attachments\":null},{\"@priority\":\"1\",\"@type\":\"Exception\",\"@state\":\"Fixed\",\"@subsystem\":\"Submitted exceptions\",\"@id\":\"DCVR-2\",\"@fixedVersion\":\"\",\"@projectShortName\":\"DCVR\",\"@reporterName\":\"ruslan.isakiev\",\"@fixedInBuild\":\"Next build\",\"@commentsCount\":\"0\",\"@numberInProject\":\"2\",\"@summary\":\"Exception : An exception has occurred during action 'OpenSnapshot' execution. Sample exception\",\"@description\":\"dotCover 1.0 Version=1.0.0.0, Built=2
map.connect '/somethin/:email', requirements => { :email => / <insert your favorite email regex here> / }
public class HandleRecordNotFoundAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
var viewResult = filterContext.Result as ViewResult;
if (viewResult != null && viewResult.ViewData.Model == null)
{
filterContext.Result = new ResourceNotFoundResult();
filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);