NPv.Auth.Ef
0.2.1
dotnet add package NPv.Auth.Ef --version 0.2.1
NuGet\Install-Package NPv.Auth.Ef -Version 0.2.1
<PackageReference Include="NPv.Auth.Ef" Version="0.2.1" />
<PackageVersion Include="NPv.Auth.Ef" Version="0.2.1" />
<PackageReference Include="NPv.Auth.Ef" />
paket add NPv.Auth.Ef --version 0.2.1
#r "nuget: NPv.Auth.Ef, 0.2.1"
#:package NPv.Auth.Ef@0.2.1
#addin nuget:?package=NPv.Auth.Ef&version=0.2.1
#tool nuget:?package=NPv.Auth.Ef&version=0.2.1
NPv.Auth.Ef
Entity Framework Core mappings for NPv authentication realms.
The package maps account, email-confirmation, password-recovery, and refresh-token
entities to a configurable table prefix. The consuming application owns its
DbContext, database connection, and migrations.
Status
This package is at an early stage (0.x). Its public API and database mapping may
change between minor versions.
Installation
dotnet add package NPv.Auth.Ef
Apply a realm mapping from the consuming DbContext:
modelBuilder.MapAuthRealm<Account, EmailConfirmation, PasswordRecovery, RefreshToken>(
"auth_accounts");
Custom realm mapping contract
Start with the Domain entity contract.
Beyond its generic base-type constraints, MapAuthRealm requires these CLR
navigation properties by exact name and matching concrete type:
| Entity | Navigation |
|---|---|
| Account | Confirmation of the realm's confirmation type; Recovery of its recovery type (both may be null). |
| Confirmation, Recovery, RefreshToken | Account of the realm's account type. |
Base classes do not supply these properties. No refresh-token collection on Account is required. The mapper configures the relationships from the Domain contract with cascade deletion for all three dependent entity types.
tablePrefix must be nonblank. It is the exact account table name; dependent
tables use _confirmation, _recovery, and _refresh_tokens suffixes. Unique
indexes cover account Email and refresh-token TokenHash.
Apply mapping once per realm with its own concrete entity set and distinct table
prefix (e.g. admin_accounts and trader_accounts in one DbContext). Use the
same entity set for host registration.
The host maps additional business fields/relationships and reviews migrations.
See the Domain README for the scoped-users boundary.
Author's Note
This library grew out of my long-standing personal interest in structuring and publishing open source packages. Over time, I’ve revisited and refined earlier internal utilities and ideas, giving them a more consistent shape and preparing them for wider reuse. Along the way, I’ve also taken the opportunity to explore how open source distribution and licensing work in the .NET ecosystem.
It’s a small step toward something I’ve always wanted to try — sharing practical, minimal tools that reflect years of learning, experimentation, and refinement.
Hopefully, someone finds it useful.
Nikolai 😛
⚖️ License
MIT — you are free to use this in commercial and open-source software.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.13)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.13)
- NPv.Auth.Domain (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.