Для Blazor WASM вы устанавливаете DI в Program
, используя WebAssemblyHostBuilder.Services
:
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddSingleton<SengaltonServices>();
await builder.Build().RunAsync();
}
}