Skip to content
vborovikovPublic

About

ASP.NET Core Identity storage providers that use Dapper

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spryer.AspNetCore.Identity

ASP.NET Core Identity storage providers that use Dapper.

Packages

Package Version Downloads
Spryer NuGet Downloads
Spryer.AspNetCore.Identity NuGet Downloads
Spryer.AspNetCore.Identity.SqlServer NuGet Downloads
Spryer.AspNetCore.Identity.Sqlite NuGet Downloads

Usage

public sealed class AppUser : IdentityUser<Guid>
{
    public AppUser()
    {
        // default Identity UI uses this ctor when registering new users
        this.Id = Guid.NewGuid();
        this.SecurityStamp = Guid.NewGuid().ToString();
    }
}

public sealed class AppRole : IdentityRole<Guid>
{
    public AppRole()
    {
        // default Identity UI uses this ctor when creating new roles
        this.Id = Guid.NewGuid();
    }
}

// Program.cs

var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ??
    throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");

builder.Services.AddSingleton(_ => SqlClientFactory.Instance.CreateDataSource(connectionString));

builder.Services
    .AddIdentity<AppUser, AppRole>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddDapperStores(options => 
    {
        options.UseSqlServer();
    })
    .AddDefaultUI()
    .AddDefaultTokenProviders();

About

ASP.NET Core Identity storage providers that use Dapper

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages