Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Latest commit

 

History

History
39 lines (29 loc) · 1.23 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.23 KB

ASP.NET Core Identity Provider for NHibernate

Nuget packages:

NHibernate.AspNetCore.Identity

ASPNET Core Identity provider that uses NHibernate for storage

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 path = System.IO.Path.Combine(
            AppDomain.CurrentDomain.BaseDirectory,
            "hibernate.config"
        );

        services.AddHibernate(path);
        services.AddDefaultIdentity<NHibernate.AspNetCore.Identity.IdentityUser>()
            .AddRoles<NHibernate.AspNetCore.Identity.IdentityRole>()
            .AddHibernateStores();

    }
}

For more detailed samples, please look at the WebTest project.