using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection; using ScadaLink.CentralUI.Auth; using ScadaLink.CentralUI.Components.Shared; using ScadaLink.CentralUI.ScriptAnalysis; namespace ScadaLink.CentralUI; public static class ServiceCollectionExtensions { public static IServiceCollection AddCentralUI(this IServiceCollection services) { services.AddRazorComponents() .AddInteractiveServerComponents(); services.AddHttpContextAccessor(); services.AddScoped(); services.AddCascadingAuthenticationState(); // Centralised dialog service: pages inject IDialogService and a single // in MainLayout renders the active dialog. See // Components/Shared/IDialogService.cs. services.AddScoped(); // Roslyn-backed C# analysis for the Monaco script editor. // Scoped because SharedScriptService (a dependency) is scoped. services.AddScoped(); return services; } }