NHibernate.AspNetCore.Identity
8.0.9
See the version list below for details.
dotnet add package NHibernate.AspNetCore.Identity --version 8.0.9
NuGet\Install-Package NHibernate.AspNetCore.Identity -Version 8.0.9
<PackageReference Include="NHibernate.AspNetCore.Identity" Version="8.0.9" />
paket add NHibernate.AspNetCore.Identity --version 8.0.9
#r "nuget: NHibernate.AspNetCore.Identity, 8.0.9"
// Install NHibernate.AspNetCore.Identity as a Cake Addin #addin nuget:?package=NHibernate.AspNetCore.Identity&version=8.0.9 // Install NHibernate.AspNetCore.Identity as a Cake Tool #tool nuget:?package=NHibernate.AspNetCore.Identity&version=8.0.9
NHibernate.AspNetCore.Identity
ASP.NET Core Identity Provider implemented with NHibernate
Nuget package:
About Version
- 7.0.x is compatible with .Net 7.0.x;
- 6.0.x is compatible with .Net 6.0.x;
- 5.0.x is compatible with .Net 5.0.x;
- 3.1.x is compatible with .Net Core 3.1.x;
- 3.0.x is compatible with .Net Core 3.0.x;
Usage
1. Create a Asp.Net Core Mvc Project with identity support
dotnet new mvc --auth Individual
2. Add reference to NHibernate.AspNetCore.Identity
and NHibernate.NetCore
dotnet add package NHibernate.AspNetCore.Identity
dotnet add package NHibernate.NetCore
NHibernate
will be installed automatically.
3. Setup database
Use the sql scripts in
database
folder to create aspnet identity related tables, only support postgresql, mssql and mysql now;If you want other database support, please let me know, any issue, pull request is welcome!
Config NHibernate to use your database;
4. Change Startup.cs
to use database and nhibernate
public class Startup {
public void ConfigureServices(
IServiceCollection services
) {
// Remove EFCore stores.
// services.AddDbContext<ApplicationDbContext>(
// options =>
// options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
// services.AddDefaultIdentity<IdentityUser>()
// .AddEntityFrameworkStores<ApplicationDbContext>();
// Add Hibernate stores
var cfg = new Configuration();
var file = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"hibernate.config"
);
cfg.Configure(file);
// Add identity mapping based on dialect config (dialet must contains
// PostgreSQL, MySQL, MsSql or Sqlite)
cfg.AddIdentityMappings();
// using default xml mapping.
cfg.AddAssembly(typeof(Startup).Assembly);
// using `NHibernate.Mapping.ByCode`, please comment the line above,
// and uncomment line flowing lines;
// var modelMapper = new NHibernate.Mapping.ByCode.ModelMapper();
// modelMapper.AddMapping<WebTest.Entities.AppRoleMapping>();
// modelMapper.AddMapping<WebTest.Entities.AppUserMapping>();
// modelMapper.AddMapping<WebTest.Entities.TodoItemMapping>();
// var mappings = modelMapper.CompileMappingForAllExplicitlyAddedEntities();
// cfg.AddMapping(mappings);
services.AddHibernate(cfg);
services.AddDefaultIdentity<WebTest.Entities.ApplicationUser>()
.AddRoles<WebTest.Entities.ApplicationRole>()
.AddHibernateStores();
}
}
Note: When using with SqlServer, you need add
System.Data.SqlClient
package to your project.
For more detailed samples, please look at the WebTest project.
Credits
Special thanks to the following individuals, organisations and projects whose work is so important to the success of NHibernate (in no particular order):
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Identity.Core (>= 8.0.7)
- Microsoft.Extensions.Identity.Stores (>= 8.0.7)
- NHibernate (>= 5.5.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.10 | 880 | 8/19/2024 |
8.0.9 | 673 | 7/15/2024 |
8.0.8 | 210 | 7/8/2024 |
8.0.7 | 405 | 6/6/2024 |
8.0.6 | 320 | 5/11/2024 |
8.0.5 | 322 | 4/1/2024 |
8.0.4 | 170 | 3/20/2024 |
8.0.3 | 608 | 2/17/2024 |
8.0.2 | 249 | 2/4/2024 |
8.0.1 | 478 | 12/27/2023 |
8.0.0 | 605 | 11/19/2023 |
7.0.12 | 627 | 9/28/2023 |
7.0.11 | 510 | 9/2/2023 |
7.0.10 | 1,342 | 8/19/2023 |
7.0.9 | 203 | 8/4/2023 |
7.0.8 | 333 | 7/8/2023 |
7.0.7 | 209 | 7/8/2023 |
7.0.5 | 888 | 4/21/2023 |
7.0.4 | 484 | 4/10/2023 |
7.0.3 | 292 | 4/3/2023 |
7.0.2 | 253 | 4/3/2023 |
7.0.1 | 1,594 | 12/20/2022 |
7.0.0 | 515 | 12/10/2022 |
6.0.12 | 1,836 | 10/25/2022 |
6.0.11 | 706 | 10/3/2022 |
6.0.10 | 1,908 | 8/11/2022 |
6.0.9 | 667 | 7/29/2022 |
6.0.8 | 1,164 | 6/24/2022 |
6.0.7 | 940 | 5/21/2022 |
6.0.6 | 665 | 5/10/2022 |
6.0.5 | 693 | 4/18/2022 |
6.0.4 | 809 | 3/9/2022 |
6.0.3 | 714 | 2/21/2022 |
6.0.2 | 703 | 2/14/2022 |
6.0.1 | 1,672 | 12/16/2021 |
6.0.0 | 1,621 | 11/21/2021 |
5.0.15 | 1,178 | 10/13/2021 |
5.0.14 | 589 | 9/28/2021 |
5.0.13 | 584 | 9/15/2021 |
5.0.12 | 678 | 8/16/2021 |
5.0.11 | 752 | 7/28/2021 |
5.0.10 | 658 | 7/6/2021 |
5.0.9 | 735 | 6/10/2021 |
5.0.8 | 578 | 5/21/2021 |
5.0.7 | 670 | 4/22/2021 |
5.0.6 | 580 | 4/13/2021 |
5.0.5 | 901 | 3/22/2021 |
5.0.4 | 699 | 2/24/2021 |
5.0.3 | 653 | 1/30/2021 |
5.0.2 | 911 | 12/15/2020 |
5.0.1 | 677 | 11/18/2020 |
5.0.0 | 612 | 11/11/2020 |
5.0.0-rc.2 | 269 | 11/2/2020 |
5.0.0-rc.1 | 272 | 9/15/2020 |
3.1.9 | 5,882 | 8/19/2020 |
3.1.8 | 14,100 | 6/15/2020 |
3.1.7 | 4,123 | 4/28/2020 |
3.1.6 | 6,779 | 4/4/2020 |
3.1.5 | 5,096 | 3/7/2020 |
3.1.4 | 718 | 2/9/2020 |
3.1.3 | 766 | 1/19/2020 |
3.1.2 | 970 | 12/6/2019 |
3.1.1 | 660 | 12/5/2019 |
3.1.0 | 674 | 12/4/2019 |
3.0.2 | 666 | 12/3/2019 |
3.0.1 | 777 | 10/26/2019 |
3.0.0 | 767 | 10/8/2019 |
1.6.0 | 1,178 | 8/14/2019 |
1.5.0 | 1,052 | 5/10/2019 |
1.4.0 | 940 | 4/22/2019 |
1.3.0 | 847 | 4/18/2019 |
1.2.0 | 4,328 | 10/23/2018 |
1.1.0 | 1,230 | 8/18/2018 |
1.0.1 | 1,085 | 8/8/2018 |
1.0.0 | 1,135 | 7/20/2018 |
Update to .NET 8.0.7;Update Identity.Core to 8.0.7;