You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I want to use the AuthenticationStateProvider inside of my DbContext to automatically add the current User when SaveChanges is called.
So far my Startup.cs looks currently like that:
As soon as I start to Debug I run in to the following exception:
InvalidOperationException: Cannot resolve scoped service 'Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider' from root provider.
which is caused by p.GetRequiredService<IDbContextFactory<MyContext>>()
do you guys have any suggestion for me to solve this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I want to use the AuthenticationStateProvider inside of my DbContext to automatically add the current User when SaveChanges is called.
So far my Startup.cs looks currently like that:
My MyContext looks like:
As soon as I start to Debug I run in to the following exception:
InvalidOperationException: Cannot resolve scoped service 'Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider' from root provider.
which is caused by
p.GetRequiredService<IDbContextFactory<MyContext>>()
do you guys have any suggestion for me to solve this?
Btw. I am using EF Core with Blazor Server-side
Beta Was this translation helpful? Give feedback.
All reactions