Reputation: 420
I have a confused about three packages in asp.net core identity. I don't know what's the difference between each other. And also which of those should we use?
I found this link in GitHub, but I didn't get it.
Difference between Microsoft.Extensions.Identity.Stores and Microsoft.AspNetCore.Identity
Upvotes: 9
Views: 5462
Reputation: 20116
This assembly contains the entity definition of the entire asp.net core Identity framework, roughly including IdentityUser
,IdentityRole
,IdentityUserRole
, IdentityUserClaim
, IdentityRoleClaim
, IdentityUserLogin
.It can also be understood as a database table.
This assembly is mainly used to perform basic CRUD to the above entities, including user management (UserManager
) and role management (RoleManager
), and some configurations that can be performed, such as user name restrictions, password verification, and so on. Specific storage implementations need to download other packages, such as Microsoft.AspNetCore.Identity.EntityFrameworkCore
which is the implementation of data storage using EF Core.
This assembly is used to manage authentication and authorization in the AspNetCore project, and also includes the basic configuration in the AspNetCore project. For example, to use the Identity framework, you need to execute services.AddIdentity <TUser> ()
in the ConfigureServices
method.
Basic secondary development is based on the above core packages. If you want asp.net core Identity to support other ORM frameworks, such as Dapper, then you can use Microsoft.Extensions.Identity.Stores
for secondary development. Or if some business
logic does not meet your special needs, and it is also developed using this package.
If you want to extend the field, you need the Microsoft.Extensions.Identity.Core
package, and inherit the relevant classes.
Upvotes: 12