Got at least one data fetching method working; turns out, we can't use a patched LogicStack to get the data

This commit is contained in:
2026-01-14 22:11:11 +01:00
parent 40a8431464
commit 3f7122d30a
350 changed files with 41444 additions and 119 deletions

View File

@@ -0,0 +1,46 @@
using System.Threading;
using System.Threading.Tasks;
using EmbedIO.Utilities;
using Swan.Logging;
namespace EmbedIO.Internal
{
internal sealed class WebModuleCollection : DisposableComponentCollection<IWebModule>
{
private readonly string _logSource;
internal WebModuleCollection(string logSource)
{
_logSource = logSource;
}
internal void StartAll(CancellationToken cancellationToken)
{
foreach (var (name, module) in WithSafeNames)
{
$"Starting module {name}...".Debug(_logSource);
module.Start(cancellationToken);
}
}
internal async Task DispatchRequestAsync(IHttpContext context)
{
if (context.IsHandled)
return;
var requestedPath = context.RequestedPath;
foreach (var (name, module) in WithSafeNames)
{
var routeMatch = module.MatchUrlPath(requestedPath);
if (routeMatch == null)
continue;
$"[{context.Id}] Processing with {name}.".Debug(_logSource);
context.GetImplementation().Route = routeMatch;
await module.HandleRequestAsync(context).ConfigureAwait(false);
if (context.IsHandled)
break;
}
}
}
}