ASP.NET Core Identity provider that uses Entity Framework Core. This package was built from the source code at https://github.com/dotnet/dotnet/tree/87bc0b04e21d786669142109a5128c95618b75ed
$ dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCoreMicrosoft.AspNetCore.Identity.EntityFrameworkCore utilizes Entity Framework Core to provide functionality enabling the storage of user, role, and other identity-related data in a database.
To use Microsoft.AspNetCore.Identity.EntityFrameworkCore, follow these steps:
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore
Add the following code to the Program.cs of your ASP.NET Core app:
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddDefaultIdentity<ApplicationUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
You can replace ApplicationDbContext with your own database context class derived from IdentityDbContext and ApplicationUser with your own user class containing additional properties derived from IdentityUser.
Make sure to configure the connection string via "ConnectionStrings:DefaultConnection" (or whatever you rename it to) so it can connect to your database.
The main types provided by include:
Microsoft.AspNetCore.Identity.EntityFrameworkCoreIdentityDbContext: Provides the database context for storing and managing user, role, and other identity-related dataIdentityUserContext: Provides methods and properties for querying and manipulating user informationRoleStore: Provides methods for creating, updating, and deleting roles, as well as querying and managing role-related dataUserStore: Provides methods for creating, updating, and deleting users, as well as querying and managing user-related dataUserOnlyStore: Provides methods for creating, updating, and deleting users, as well as querying and managing user-related data for users without rolesFor additional documentation and examples, refer to the official documentation on ASP.NET Core Identity.
Microsoft.AspNetCore.Identity.EntityFrameworkCore is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.