BlazorDualMode
BlazorDualMode copied to clipboard
How to bootstrap client services during ServerPrerendered?
I have a client-side Blazor application with a bunch of stuff in Client/Program.cs
, setting up some libraries and services.
eg
// Client-side configuration in `Client.Program.Main`
builder.Services.AddSingleton<MyService>();
builder.Services
.AddBlazorise(options => {
options.ChangeTextOnKeyPress = true;
})
If I follow this dual mode guide and use
@(await Html.RenderComponentAsync<Client.App>(RenderMode.ServerPrerendered))
Then I do not get these services registered and rendering fails.
How should this be configured?
@koliyo you can create helper service extension class and register in the the startup.