diff options
author | vnugent <public@vaughnnugent.com> | 2023-04-13 11:37:30 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-04-13 11:37:30 -0400 |
commit | 0bafd510a0091960dbfe5ad08d3d524153117536 (patch) | |
tree | 414a00aae7afc84f9b11d6bd7395248d5d24b668 /plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs | |
parent | 5d0660dea5e20d1bda06ea9b06b04bbac36b0db9 (diff) |
Database creation tools
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs')
-rw-r--r-- | plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs index 0c04047..e71ee6b 100644 --- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs +++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs @@ -23,12 +23,14 @@ */ using System; +using System.Threading.Tasks; using System.ComponentModel.Design; using VNLib.Utils.Logging; using VNLib.Plugins.Attributes; using VNLib.Plugins.Extensions.Loading; - +using VNLib.Plugins.Extensions.Loading.Sql; +using VNLib.Plugins.Essentials.Content.Routing.Model; namespace VNLib.Plugins.Essentials.Content.Routing { @@ -49,6 +51,10 @@ namespace VNLib.Plugins.Essentials.Content.Routing { //Init router PageRouter = this.GetOrCreateSingleton<Router>(); + + //Schedule the db creation + _ = this.ObserveWork(OnDbCreationAsync, 500); + Log.Information("Plugin loaded"); } @@ -65,5 +71,11 @@ namespace VNLib.Plugins.Essentials.Content.Routing Log.Information("Routing table reset"); } } + + private async Task OnDbCreationAsync() + { + //Create the router + await this.EnsureDbCreatedAsync<RoutingContext>(null); + } } } |