Fix ASP0014 warning: Use top-level route registration for ElectronHub

Changed from app.UseEndpoints() pattern to direct app.MapHub() call,
following modern ASP.NET Core conventions. This removes the analyzer
warning while maintaining the same functionality.
This commit is contained in:
Pierre Arnaud
2026-01-30 17:14:14 +01:00
parent 12f011bc33
commit 17ef6853ab

View File

@@ -65,14 +65,11 @@ app.UseStaticFiles();
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
// UseAntiforgery must be between UseRouting and UseEndpoints
// UseAntiforgery must be after UseRouting
app.UseAntiforgery();
// Use endpoints for SignalR hub
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<ElectronNET.AspNet.Hubs.ElectronHub>("/electron-hub");
});
// Map SignalR hub for Electron communication
app.MapHub<ElectronNET.AspNet.Hubs.ElectronHub>("/electron-hub");
app.MapStaticAssets();
app.MapRazorComponents<ElectronNET.Samples.BlazorSignalR.Components.App>()