public async Task <string> Any(EvaluateScript request) { var context = new ScriptContext { DebugMode = false, ScriptLanguages = { ScriptLisp.Language }, ScriptMethods = { new DbScriptsAsync(), new AutoQueryScripts(), new ServiceStackScripts(), new CustomScriptMethods(), }, Plugins = { new ServiceStackScriptBlocks(), new MarkdownScriptPlugin(), } }; //Register any dependencies filters need: context.Container.AddSingleton(() => base.GetResolver().TryResolve <IDbConnectionFactory>()); context.Init(); var pageResult = new PageResult(context.OneTimePage(request.Template)) { Args = base.Request.GetScriptRequestParams(importRequestParams: true) }; return(await pageResult.RenderToStringAsync()); // render to string so [ReturnExceptionsInJson] can detect Exceptions and return JSON }