ASP.NET Core Identity scaffolded items with non-EF-Core custom UserStore #26003
Unanswered
dahlsailrunner
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on an ASP.NET Core application and am retrofitting an existing user database into ASP.NET Core Identity using a custom
UserStore
as described in the MS Docs.I'm not using a DbContext at all and have defined a
CustomUser
class that inherits fromIdentityUser<int>
. When I go to add scaffolded items for the various Identity UI pages, I always need to let it create a newDbContext
which I delete and also I specify myCustomUser
class which seems to be ignored, because the generated pages are injecting services of type<IdentityUser>
rather than my<CustomUser>
.This repo can be cloned to see what I mean: https://github.com/dahlsailrunner/secure-auth-scratchpad
If you clone and open that repo, then add one or more scaffolded Identity items, I always end up needing to correct the following:
IdentityHostingStartup.cs
fileGlobomanticsCoreIndAccContext.cs
file_ManageNav.cshtml
file to use theCustomUser
type instead ofIdentityUser
CustomUser
instead ofIdentityUser
@Rick-Anderson suggested that I create an issue for this but it seems like a discussion. I'm just wondering if this can be improved upon so that we could simply provide the class name of the Identity type (CustomUser) in my case and have the scaffolded items reference that instead of doing anything with EF Core contexts?
Alternatively, some documentation could be added to help folks not using EF Core to get them through this process. Providing scaffolding for these items is enormously helpful and I'd hate for folks to get hung up just because they are not using EF Core for this.
Any input would be very welcome - and I am willing to help or contribute given a direction.
Beta Was this translation helpful? Give feedback.
All reactions