Blazor - Identity Scaffolding Fails
Hi all, trying to scaffold identity into a blazor app. I have an
AuthDbContext
that looks like this
When in the scaffolding wizard, I select this db context. It works up to a point, but then I get an exception popup from Visual Studio:
Googling this issue doesn't find me any results for this particular error. Any ideas?6 Replies
The logs do say "Empty or invalid namespace provided, using default namespace"
Not sure if that matters here
Ran
dotnet aspnet-codegenerator identity -dc AuthDbContext
and it worked. I got a new folder called Areas and it correctly scaffolded all of the items, albeit as cshtml instead of razor.
I may have to manually migrate these to .razor files and put them in the Components directory, but it's a step in the right directionBtw what do you mean by scaffolding here ? You mean like the scaffolding wizard for a DB Model ? To make controller/pages for it ?
Scaffold Identity in ASP.NET Core projects
Learn how to scaffold Identity in an ASP.NET Core project.
Oh okay
Have you made a separate Data Context for scaffolding Identity ?
Btw these threads are pretty similar if you haven't tried them already :
https://learn.microsoft.com/en-us/answers/questions/1182727/how-to-fix-asp-net-core-there-was-an-error-running
SO :
https://stackoverflow.com/questions/52022112/asp-net-core-adding-view-parameter-name-path-cannot-be-null-error
I have, yes
Both of these say that I need a package installed, which I have already.
Idk if it'll help or not but can you scaffold it using your default DB Context and not the new context you created ?
and if you try this, make sure that your default context doesn't inherti from Identity..