Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Is there a way to refresh the DI object only (Blazor Server)

$
0
0

I have an issue with Blazor Server:

my DI always get the same ID (instance) on the component's button click

DI

For example:ILoginService.ID = "123"

When i click a button - if the login fails , and retry it will have the same instance ID ="123"

The dependency injection was defined below:DI Definition

I am aware that if I refresh the page, the DI will work as expected (because it is scope service - new every request) . but it's not fit on my scenario.

I have to refresh the DI object only before or after the button click, so i have a new instance each button click

Is there a way to refresh the DI object only

Already changed the lifetime of DI to transient. Still not workingchnged

I was expecting the following

Before Click:ILoginService.ID = "123"

Then Login failedRetry ClickILoginService.ID = "456"


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>