David Carr
David Carr
Its been a while I can't seem to replicate the issue as of this moment.
if you check out the IdentityUser class it should be simple to roll your own. https://github.com/aspnet/Identity/blob/4e5bba35da259fa79a90426ed02a72f0c03ec861/src/Microsoft.AspNet.Identity.EntityFramework/IdentityUser.cs
If you check code the SignInManager class it performs a FindByNameAsync to retrieve the user. https://github.com/aspnet/Identity/blob/acfee9e7e05bfb8ef25c8a7628c200c4cc715ff0/src/Microsoft.AspNet.Identity/SignInManager.cs#L239-L248
The Account class is being incorrectly mapped in the call to AddIdentity.
Looks good I just saw this code and was not sure. ``` public class ApplicationUser : IdentityUser { } ```
Diving into the codebase all of the identity classes use string keys by default, you are requesting an int key type: https://github.com/aspnet/Identity/blob/5da757642dd7c7a25315250ae3738b87f622cb4c/src/Microsoft.AspNet.Identity.EntityFramework/IdentityEntityFrameworkServices.cs#L22-L23
Interesting your instatiating the service potentially inside the controller. Why do that?
Yes that would work but not ideal. How are you constructing the controller?
The newing code should be removed and let DI deal with the lifetime. There some scoped dependencies inside the manager which force your hand a little.
Also no need to inject the manager in the controller if you are constructing it as part of the service. But that is down to your implementation.