AdaskoTheBeAsT.Identity.Dapper
4.0.0
dotnet add package AdaskoTheBeAsT.Identity.Dapper --version 4.0.0
NuGet\Install-Package AdaskoTheBeAsT.Identity.Dapper -Version 4.0.0
<PackageReference Include="AdaskoTheBeAsT.Identity.Dapper" Version="4.0.0" />
<PackageVersion Include="AdaskoTheBeAsT.Identity.Dapper" Version="4.0.0" />
<PackageReference Include="AdaskoTheBeAsT.Identity.Dapper" />
paket add AdaskoTheBeAsT.Identity.Dapper --version 4.0.0
#r "nuget: AdaskoTheBeAsT.Identity.Dapper, 4.0.0"
#:package AdaskoTheBeAsT.Identity.Dapper@4.0.0
#addin nuget:?package=AdaskoTheBeAsT.Identity.Dapper&version=4.0.0
#tool nuget:?package=AdaskoTheBeAsT.Identity.Dapper&version=4.0.0
๐ AdaskoTheBeAsT.Identity.Dapper
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, andGuidkeys - ๐๏ธ 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.sqlprojschema projectsdb/PostgreSQL/,db/MySql/,db/Oracle/, anddb/SQLite/contain SQL scripts- scripts are available for
string,int,bigint, andGuidkeys - 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();andSqliteDapperConfig.ConfigureTypeHandlers();
๐ Examples and useful docs
samples/Sample.SqlServer2โ SQL Server sample that consumes the NuGet packagessamples/Sample.SqlServerโ SQL Server sample that references local projectssrc/AdaskoTheBeAsT.Identity.Dapper.WebApiโ runnable Web API examplesamples/OracleConsoleApp/PrepareOracleDb.txtโ Oracle prep notesdb/โ provider schema scripts and SQL Server schema projects
๐ ๏ธ Local development
Prerequisites
- .NET SDK
10.0.201(pinned inglobal.json) - Docker Desktop / Docker Engine for integration tests
- PowerShell for
clean.ps1 - Visual Studio + SSDT if you need to edit SQL Server
.sqlprojdatabase 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:
- build the relevant solution filter (
WithoutSqlDb.slnforMySQL.slnf) - run the provider test project you touched
- keep generated SQL and snapshots aligned with the implementation
๐ License
This project is licensed under the MIT License.
๐ฌ Support
- Issues: https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper/issues
- NuGet: https://www.nuget.org/packages/AdaskoTheBeAsT.Identity.Dapper/
If this library saves you time, a GitHub star is always appreciated.
| Product | Versions 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. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on AdaskoTheBeAsT.Identity.Dapper:
| Package | Downloads |
|---|---|
|
AdaskoTheBeAsT.Identity.Dapper.SqlServer
Autogenerates Identity stores based on Dapper |
|
|
AdaskoTheBeAsT.Identity.Dapper.MySql
Autogenerates Identity stores based on Dapper |
|
|
AdaskoTheBeAsT.Identity.Dapper.PostgreSql
Autogenerates Identity stores based on Dapper |
|
|
AdaskoTheBeAsT.Identity.Dapper.Oracle
Autogenerates Identity stores based on Dapper |
|
|
AdaskoTheBeAsT.Identity.Dapper.Sqlite
Autogenerates Identity stores based on Dapper |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 148 | 4/8/2026 |
| 3.0.2 | 503 | 11/23/2025 |
| 3.0.1 | 387 | 11/22/2025 |
| 3.0.0 | 383 | 11/22/2025 |
| 2.0.1 | 501 | 10/11/2024 |
| 2.0.0 | 507 | 8/27/2024 |
| 1.3.0 | 874 | 7/27/2024 |
| 1.2.0 | 393 | 7/27/2024 |
| 1.1.7 | 800 | 1/14/2024 |
| 1.1.5 | 384 | 5/14/2023 |
| 1.1.4 | 341 | 5/14/2023 |
| 1.1.3 | 365 | 5/14/2023 |
| 1.1.2 | 340 | 5/14/2023 |
| 1.1.1 | 345 | 5/7/2023 |
| 1.1.0 | 315 | 5/6/2023 |
| 1.0.0 | 418 | 4/16/2023 |
- first release