I have a dozen of Automapper Profiles in my assembly, which works very well on server-side Blazor! But it's very slow(almost one minute) on Blazor WebAssembly, the problem is that the user have to wait at every page refresh, any way to workaround?
Here is the code:
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
var configuration = new MapperConfiguration(cfg =>
{
cfg.AddMaps(currentAssembly);
});
builder.Services.AddSingleton(configuration.CreateMapper());
await builder.Build().RunAsync();
}
I know that the problem is that configuration.CreateMapper() is called for every page refresh (because this is the Blazor WebAssembly behaviour), but I can't figure a way to work around.
I'm also worry to run this on slow machines...