Hello Support Team,
Within the attached solution, I have two projects. Both are Blazor Webassembly Standalone App. The first project called SfBlazorStandaloneIssue has been generated by your Syncfusion Blazor Template Studio V 26.2.4, while the second project called VsBlazorStandaloneApp has been generated by the normal VS2022 wizard.
In both projects:
- I added a simple CounterServices.cs class which increments a counter.
- I registered this class with AddSingleton() because I wanted to share the value of the counter on all pages.
- I injected the CounterServices in both Counter.razor and Weather.razor pages.
What I do not understand is:
- With the VsBlazorStandaloneApp project, If I navigate between Counter and Weather pages and increment the counter value in one or the other page, the value is kept as expected (remember, the service is Singleton).
- But with the SfBlazorStandaloneIssue project, the counter value is reseted ... Sounds like the service is not a Singleton.
Can you please provide a support. What I'm doing wrong?
Thank you in advance.
Artilizansa.
Attachment:
SfBlazorStandaloneIssue_b3e0e47.zip