All Projects → nhibernate → NHibernate.AspNetCore.Identity

nhibernate / NHibernate.AspNetCore.Identity

Licence: LGPL-2.1 license
ASP.NET Core Identity Provider for NHibernate

Programming Languages

C#
18002 projects
HTML
75241 projects
TSQL
950 projects

Projects that are alternatives of or similar to NHibernate.AspNetCore.Identity

Weapsy
ASP.NET Core CMS
Stars: ✭ 748 (+1285.19%)
Mutual labels:  aspnetcore, mssql
docker-workshop-with-react-aspnetcore-redis-rabbitmq-mssql
An Asp.Net Core Docker workshop project that includes react ui, redis, mssql, rabbitmq and azure pipelines
Stars: ✭ 53 (-1.85%)
Mutual labels:  aspnetcore, mssql
Identity.dapper
Identity package that uses Dapper instead EntityFramework for use with .NET Core
Stars: ✭ 234 (+333.33%)
Mutual labels:  aspnetcore
RabbitLight
A simple route-based RabbitMQ client for .NET
Stars: ✭ 11 (-79.63%)
Mutual labels:  aspnetcore
node-red-contrib-mssql-plus
A Node-RED node to read and write to Microsoft MS SQL Databases
Stars: ✭ 22 (-59.26%)
Mutual labels:  mssql
Restairline
DDD+CQRS+EventSourcing+Hypermedia API+ASP.NET Core 3.1+Masstransit+terraform+docker+k8s
Stars: ✭ 243 (+350%)
Mutual labels:  aspnetcore
https-aspnetcore-in-docker
ASP.NET Core app on HTTPS in Docker
Stars: ✭ 24 (-55.56%)
Mutual labels:  aspnetcore
Identityserver
An open-source, standards-compliant, and flexible OpenID Connect and OAuth 2.x framework for ASP.NET Core
Stars: ✭ 223 (+312.96%)
Mutual labels:  aspnetcore
POS---Point-Of-Sales
Point of sales proof of concept developed using Asp.Net Core 2.2. Features: Customer, Vendor, Product, Purchase Order, Goods Receive, Sales Order, Inventory Transactions and POS form.
Stars: ✭ 120 (+122.22%)
Mutual labels:  aspnetcore
SeoTags
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).
Stars: ✭ 113 (+109.26%)
Mutual labels:  aspnetcore
aspnetcore-service-fabric-hosting
This project is an extensions to ASP.NET Generic Host (HostBuilder) that simplifies development of Service Fabric Reliable Services.
Stars: ✭ 24 (-55.56%)
Mutual labels:  aspnetcore
Aspnetcore Vueclimiddleware
Helpers for building single-page applications on ASP.NET MVC Core using Vue Cli or Quasar Cli.
Stars: ✭ 253 (+368.52%)
Mutual labels:  aspnetcore
Netcorekit
💗 A crafted toolkit for building cloud-native apps on the .NET platform
Stars: ✭ 248 (+359.26%)
Mutual labels:  aspnetcore
minimal-api-example
Original blog post: https://nikiforovall.github.io/dotnet/aspnetcore/2021/09/10/opinionated-minimal-api.html
Stars: ✭ 39 (-27.78%)
Mutual labels:  aspnetcore
Aspnetcore.proxy
ASP.NET Core Proxies made easy.
Stars: ✭ 234 (+333.33%)
Mutual labels:  aspnetcore
Samples.IdentityServer4.Saml2pIntegration
IdentityServer 4 implementation acting as SAML 2.0 IdP and SP
Stars: ✭ 51 (-5.56%)
Mutual labels:  identity-provider
Efcoresecondlevelcacheinterceptor
EF Core Second Level Cache Interceptor
Stars: ✭ 227 (+320.37%)
Mutual labels:  aspnetcore
Devarchitecture
DevArchitecture Backend Project
Stars: ✭ 243 (+350%)
Mutual labels:  aspnetcore
SharpPlugs
.Net Core 鋒利扩展
Stars: ✭ 26 (-51.85%)
Mutual labels:  aspnetcore
AspNetCore6Experiments
ASP.NET Core Blazor BFF with Azure AD and Razor page
Stars: ✭ 43 (-20.37%)
Mutual labels:  aspnetcore

NHibernate.AspNetCore.Identity

ASP.NET Core Identity Provider implemented with NHibernate

Database diagram

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):

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].