protected override bool OnBeforeAction(IEngineContext context, IController controller, IControllerContext controllerContext){ if (!(controller is IWithScriptExtensions)){ return true; } var c = controller as Controller; var extc = (IWithScriptExtensions) controller; var controllerResult = new FilterState(); try{ //extc.ScriptMachine.Reload(); extc.ExecuteExtenders("(?i)^{0}.filter.onbeforeaction", controllerResult); if (controllerResult.Executed && !controllerResult.ReturnValue){ return false; } extc.ExecuteExtenders(string.Format("(?i)^{{0}}.action.{0}.before.", c.Action)); return true; } catch (Exception ex){ ErrorsController.RedirectToException(context, controller, ex); return false; } }
private bool getIsValid(string op, object obj){ var fs = new FilterState(); ((IWithScriptExtensions) this).ExecuteExtenders(string.Format("^{{0}}action.{0}.validate", op), fs, obj); if (fs.Executed){ if (fs.Exception.yes()){ throw fs.Exception; } if (!fs.ReturnValue){ Response.Write(fs.Message); return false; } } return true; }