I currently have a .NET Core web application focused on the full .NET Framework and a .NET 4.6.1 class library project containing my EF6 implementation.
I have these two working together now.
Now I need to add Identity, but I need to configure the implementation. (If that matters, I'm building against an existing user table and only care about local logins)
So, in the class library project 4.6.1, I created personalized Identity classes / stores / managers with this guide: https://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in -aspnet-identity
The part I'm stuck with is setting up the .NET Core application to use the non-server version of Identity.
All textbooks have configs similar to
services.AddIdentity<ApplicationUser, ApplicationRole>(config => { }) .AddEntityFrameworkStores<ApplicationDbContext>();
and
app.UseIdentity();
However, both of these methods exist only in Microsoft.AspNetCore.Identity, and not in Microsoft.AspNet.Identity.Core, which uses the class library.
What frameworks should the .NET Core application have? And what should the Startup.cs configuration look like?
To keep things simple, all of my individual identification codes are exactly what is in the article above.
The Startup.cs code looks like this (with an AspNetCore.Identity link)
services.AddIdentity<ApplicationUser, CustomRole>(config => { }) .AddUserManager<ApplicationUserManager>() .AddUserStore<CustomRoleStore>() .AddDefaultTokenProviders();
Sample Controller
public AccountController(ApplicationSignInManager signInManager) { _signInManager = signInManager; }
Error trying to start it
InvalidOperationException: The ApplicationUserManager type should be inferred from the UserManager.
c # asp.net-core-mvc asp.net-identity
Brandon
source share