From b2ab9035c186dd6bb9bc6268a6799b86f369d657 Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 17 Sep 2024 14:32:41 -0400 Subject: test some mvc extensions updates --- .../src/ManagedRouteStore.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'plugins/VNLib.Plugins.Essentials.Content.Routing') diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs index 8c32e71..65b115c 100644 --- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs +++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs @@ -26,6 +26,7 @@ using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; +using VNLib.Utils.Logging; using VNLib.Plugins.Extensions.Loading; using VNLib.Plugins.Extensions.Loading.Sql; using VNLib.Plugins.Essentials.Content.Routing.Model; @@ -33,10 +34,16 @@ using VNLib.Plugins.Essentials.Content.Routing.stores; namespace VNLib.Plugins.Essentials.Content.Routing { - [ConfigurationName("store")] + [ConfigurationName("store", Required = false)] internal sealed class ManagedRouteStore : IRouteStore { - private readonly IRouteStore _routeStore; + private readonly IRouteStore _routeStore = new DummyRouteStore(); + + //empty constructor for + public ManagedRouteStore(PluginBase plugin) + { + plugin.Log.Warn("Page router loaded but no route store was loaded. Routing funtionality is disabled."); + } public ManagedRouteStore(PluginBase plugin, IConfigScope config) { @@ -60,5 +67,11 @@ namespace VNLib.Plugins.Essentials.Content.Routing { return _routeStore.GetAllRoutesAsync(routes, cancellation); } + + private sealed class DummyRouteStore : IRouteStore + { + public Task GetAllRoutesAsync(ICollection routes, CancellationToken cancellation) + => Task.CompletedTask; + } } } -- cgit