maintenance: plugin refactoring

This commit is contained in:
Gary Sharp
2022-12-04 13:40:16 +11:00
parent 05593a1466
commit 4f9f0fd0a8
12 changed files with 402 additions and 129 deletions
+15 -3
View File
@@ -16,6 +16,8 @@ namespace Disco.Services.Plugins
{
public PluginManifest Manifest { get; set; }
public Controller HostController { get; set; }
public UrlHelper Url { get; set; }
protected DiscoDataContext Database;
private Lazy<WebHelper> plugin;
protected WebHelper Plugin
@@ -29,10 +31,7 @@ namespace Disco.Services.Plugins
public PluginWebHandler()
{
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => new WebHelper(HostController.HttpContext, Manifest)));
}
public void OnActionExecuting()
{
Database = new DiscoDataContext();
Database.Configuration.LazyLoadingEnabled = false;
}
@@ -169,6 +168,19 @@ namespace Disco.Services.Plugins
}
#endregion
#region Status Codes
public ActionResult Ok()
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.OK);
}
public ActionResult Ok(string description)
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.OK, description);
}
#endregion
#region Content
public ActionResult Content(string content, string contentType, Encoding contentEncoding)
{