AdaskoTheBeAsT.Identity.Dapper.SqlServer 4.0.0

dotnet add package AdaskoTheBeAsT.Identity.Dapper.SqlServer --version 4.0.0
                    
NuGet\Install-Package AdaskoTheBeAsT.Identity.Dapper.SqlServer -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AdaskoTheBeAsT.Identity.Dapper.SqlServer" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AdaskoTheBeAsT.Identity.Dapper.SqlServer" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AdaskoTheBeAsT.Identity.Dapper.SqlServer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AdaskoTheBeAsT.Identity.Dapper.SqlServer --version 4.0.0
                    
#r "nuget: AdaskoTheBeAsT.Identity.Dapper.SqlServer, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AdaskoTheBeAsT.Identity.Dapper.SqlServer@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AdaskoTheBeAsT.Identity.Dapper.SqlServer&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AdaskoTheBeAsT.Identity.Dapper.SqlServer&version=4.0.0
                    
Install as a Cake Tool

๐Ÿš€ AdaskoTheBeAsT.Identity.Dapper

License NuGet SDK Target

Compile-time ASP.NET Core Identity stores for Dapper.

If you like ASP.NET Core Identity but do not want EF Core in the store layer, this repository gives you source-generated stores and SQL for SQL Server, PostgreSQL, MySQL, Oracle, and SQLite.

โœจ Why developers like it

  • โšก Fast runtime path powered by Dapper
  • ๐Ÿง  Source-generated stores and provider-specific SQL instead of hand-written plumbing
  • ๐Ÿงฉ Works with string, int, long, and Guid keys
  • ๐Ÿ—๏ธ Supports custom Identity properties and custom column names
  • ๐Ÿ—„๏ธ Covers SQL Server, PostgreSQL, MySQL, Oracle, and SQLite
  • ๐ŸŽ›๏ธ Lets you skip normalized columns when you do not need them
  • ๐Ÿงช Backed by provider-specific unit and integration tests

๐Ÿ—„๏ธ Supported providers

Provider NuGet package Default schema Extra startup step
SQL Server AdaskoTheBeAsT.Identity.Dapper.SqlServer dbo none
PostgreSQL AdaskoTheBeAsT.Identity.Dapper.PostgreSql public PostgreSqlDapperConfig.ConfigureTypeHandlers();
MySQL AdaskoTheBeAsT.Identity.Dapper.MySql n/a MySqlDapperConfig.ConfigureTypeHandlers();
Oracle AdaskoTheBeAsT.Identity.Dapper.Oracle empty by default OracleDapperConfig.ConfigureTypeHandlers();
SQLite AdaskoTheBeAsT.Identity.Dapper.Sqlite n/a SQLitePCL.Batteries.Init(); and SqliteDapperConfig.ConfigureTypeHandlers();

The shared runtime package is AdaskoTheBeAsT.Identity.Dapper; most applications install a provider package and let that pull in the core runtime.

โšก Quick start

1. Install the provider package you need

# SQL Server
dotnet add package AdaskoTheBeAsT.Identity.Dapper.SqlServer

# PostgreSQL
dotnet add package AdaskoTheBeAsT.Identity.Dapper.PostgreSql

# MySQL
dotnet add package AdaskoTheBeAsT.Identity.Dapper.MySql

# Oracle
dotnet add package AdaskoTheBeAsT.Identity.Dapper.Oracle

# SQLite
dotnet add package AdaskoTheBeAsT.Identity.Dapper.Sqlite

2. Define your Identity types

using System.ComponentModel.DataAnnotations.Schema;
using AdaskoTheBeAsT.Identity.Dapper.Attributes;
using Microsoft.AspNetCore.Identity;

namespace MyApp.Identity;

public sealed class ApplicationRole : IdentityRole<Guid>
{
}

public sealed class ApplicationRoleClaim : IdentityRoleClaim<Guid>
{
}

[InsertOwnId]
public sealed class ApplicationUser : IdentityUser<Guid>
{
    [Column("IsActive")]
    public bool IsActive { get; set; }
}

public sealed class ApplicationUserClaim : IdentityUserClaim<Guid>
{
}

public sealed class ApplicationUserLogin : IdentityUserLogin<Guid>
{
}

public sealed class ApplicationUserRole : IdentityUserRole<Guid>
{
}

public sealed class ApplicationUserToken : IdentityUserToken<Guid>
{
}

[InsertOwnId] is optional and useful when you want to keep external identity IDs unchanged.

3. Add optional MSBuild settings

Provider packages already ship sensible defaults. Add overrides only when you need them:

<PropertyGroup>
  <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
  <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
  <AdaskoTheBeAsTIdentityDapper_SkipNormalized>false</AdaskoTheBeAsTIdentityDapper_SkipNormalized>
  <AdaskoTheBeAsTIdentityDapper_DbSchema>dbo</AdaskoTheBeAsTIdentityDapper_DbSchema>
</PropertyGroup>

4. Register the connection provider and Identity stores

The example below uses SQL Server, but the pattern is the same for other providers.

using AdaskoTheBeAsT.Identity.Dapper.Abstractions;
using Microsoft.AspNetCore.Identity;
using Microsoft.Data.SqlClient;

builder.Services.AddSingleton<IIdentityDbConnectionProvider<SqlConnection>, IdentityDbConnectionProvider>();

builder.Services.AddIdentity<ApplicationUser, ApplicationRole>()
    .AddUserStore<ApplicationUserStore>()
    .AddRoleStore<ApplicationRoleStore>()
    .AddDefaultTokenProviders();

public sealed class IdentityDbConnectionProvider : IIdentityDbConnectionProvider<SqlConnection>
{
    private readonly IConfiguration _configuration;

    public IdentityDbConnectionProvider(IConfiguration configuration)
    {
        _configuration = configuration;
    }

    public SqlConnection Provide() => new(_configuration.GetConnectionString("DefaultConnection")!);
}

ApplicationUserStore, ApplicationUserOnlyStore, and ApplicationRoleStore are generated during build.

5. Build once to generate the stores

dotnet build

If EmitCompilerGeneratedFiles is enabled, generated files are written to the folder configured by CompilerGeneratedFilesOutputPath.

6. Create the database schema

This library generates store code and SQL access logic, but it does not create your database schema for you.

Use the scripts in db/:

  • db/SqlServer/ contains SSDT-style .sqlproj schema projects
  • db/PostgreSQL/, db/MySql/, db/Oracle/, and db/SQLite/ contain SQL scripts
  • scripts are available for string, int, bigint, and Guid keys
  • each provider includes normalized and WithoutNormalized... variants

โš™๏ธ Configuration reference

Property Default Applies to What it changes
EmitCompilerGeneratedFiles false all providers writes generated code to disk
CompilerGeneratedFilesOutputPath Generated all providers changes the generated output folder
AdaskoTheBeAsTIdentityDapper_SkipNormalized false all providers skips normalized role and user columns
AdaskoTheBeAsTIdentityDapper_DbSchema dbo / public / empty SQL Server, PostgreSQL, Oracle changes the schema prefix used by generated SQL
AdaskoTheBeAsTIdentityDapper_StoreBooleanAs char Oracle only stores booleans as char, number, or string

Provider notes

  • PostgreSQL: call PostgreSqlDapperConfig.ConfigureTypeHandlers();
  • MySQL: call MySqlDapperConfig.ConfigureTypeHandlers();
  • Oracle: call OracleDapperConfig.ConfigureTypeHandlers();
  • SQLite: call SQLitePCL.Batteries.Init(); and SqliteDapperConfig.ConfigureTypeHandlers();

๐Ÿ“š Examples and useful docs

๐Ÿ› ๏ธ Local development

Prerequisites

  • .NET SDK 10.0.201 (pinned in global.json)
  • Docker Desktop / Docker Engine for integration tests
  • PowerShell for clean.ps1
  • Visual Studio + SSDT if you need to edit SQL Server .sqlproj database projects

Handy commands

# restore everything
dotnet restore AdaskoTheBeAsT.Identity.Dapper.sln

# recommended filtered build loop
dotnet build WithoutSqlDb.slnf

# focused MySQL loop
dotnet build MySQL.slnf

# run the Web API sample
dotnet run --project src/AdaskoTheBeAsT.Identity.Dapper.WebApi/AdaskoTheBeAsT.Identity.Dapper.WebApi.csproj

# run a provider unit snapshot test project
dotnet test test/unit/AdaskoTheBeAsT.Identity.Dapper.PostgreSql.Test/AdaskoTheBeAsT.Identity.Dapper.PostgreSql.Test.csproj

# run a provider integration test project (Docker required)
dotnet test test/integ/AdaskoTheBeAsT.Identity.Dapper.Sqlite.IntegrationTest/AdaskoTheBeAsT.Identity.Dapper.Sqlite.IntegrationTest.csproj

# clean bin/obj folders
pwsh ./clean.ps1

๐Ÿงญ Repository map

src/
  AdaskoTheBeAsT.Identity.Dapper/            shared runtime abstractions and base store types
  AdaskoTheBeAsT.Identity.Dapper.SqlServer/  SQL Server source generator package
  AdaskoTheBeAsT.Identity.Dapper.PostgreSql/ PostgreSQL source generator package
  AdaskoTheBeAsT.Identity.Dapper.MySql/      MySQL source generator package
  AdaskoTheBeAsT.Identity.Dapper.Oracle/     Oracle source generator package
  AdaskoTheBeAsT.Identity.Dapper.Sqlite/     SQLite source generator package
  AdaskoTheBeAsT.Identity.Dapper.WebApi/     runnable example app

db/        schema scripts and SQL Server schema projects
samples/   consumer samples and provider-specific notes
test/      provider unit snapshot tests and integration tests

๐Ÿค Contributing

Pull requests are welcome. A good contributor loop is:

  1. build the relevant solution filter (WithoutSqlDb.slnf or MySQL.slnf)
  2. run the provider test project you touched
  3. keep generated SQL and snapshots aligned with the implementation

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ’ฌ Support

If this library saves you time, a GitHub star is always appreciated.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
4.0.0 44 4/8/2026
3.0.2 211 11/23/2025
3.0.1 203 11/22/2025
3.0.0 215 11/22/2025
2.0.1 277 10/11/2024
2.0.0 224 8/27/2024
1.3.0 211 7/27/2024
1.2.0 194 7/27/2024
1.1.7 300 1/14/2024
1.1.5 284 5/14/2023
1.1.4 261 5/14/2023
1.1.3 266 5/14/2023
1.1.2 267 5/14/2023
1.1.1 272 5/7/2023
1.1.0 268 5/6/2023
1.0.0 292 4/16/2023

- first release