AugusteVN.Modules.Auth.Database
1.0.9
dotnet add package AugusteVN.Modules.Auth.Database --version 1.0.9
NuGet\Install-Package AugusteVN.Modules.Auth.Database -Version 1.0.9
<PackageReference Include="AugusteVN.Modules.Auth.Database" Version="1.0.9" />
<PackageVersion Include="AugusteVN.Modules.Auth.Database" Version="1.0.9" />
<PackageReference Include="AugusteVN.Modules.Auth.Database" />
paket add AugusteVN.Modules.Auth.Database --version 1.0.9
#r "nuget: AugusteVN.Modules.Auth.Database, 1.0.9"
#:package AugusteVN.Modules.Auth.Database@1.0.9
#addin nuget:?package=AugusteVN.Modules.Auth.Database&version=1.0.9
#tool nuget:?package=AugusteVN.Modules.Auth.Database&version=1.0.9
AugusteVN.Modules.Auth.Database
EF Core AuthDbContext with ASP.NET Identity entities, audit tracking, and seed data for the Auth module.
DbContext
AuthDbContext
Extends IdentityDbContext<User, Role, string>. Implements IAuthDbContext.
DbSets:
RolePermissions—DbSet<RolePermission>
Behavior:
- Uses
QueryTrackingBehavior.NoTrackingby default - Automatically sets
CreatedBy/CreatedAton insert andLastModifiedBy/LastModifiedAton update forUser,Role, andAuditableEntitytracked entries - Migrations assembly is set to the Database project; migration history table is prefixed
Auth_EFMigrationHistory
Entities
User— ExtendsIdentityUser, implementsIAuthUserwith:Name,CreatedAt,CreatedBy,LastModifiedAt,LastModifiedByRole— ExtendsIdentityRole, implementsIAuthRolewith:Permissions(collection ofRolePermission),Description,Type,CreatedAt,CreatedBy,LastModifiedAt,LastModifiedByRolePermission— ExtendsAuditableEntitywith:Scope(string),Sum(int bitmask),RoleId(string FK)
Interface
IAuthDbContext — Exposes RolePermissions DbSet and SaveChangesAsync via ISaveChangesAsync.
Extension Method
AddAuthDbContext(this IServiceCollection, IConfiguration) — Registers IAuthDbContext / AuthDbContext with SQL Server using the DefaultConnection connection string.
Registration
builder.Services.AddAuthDbContext(builder.Configuration);
Seed Data
The Seeder class provides ModelBuilder extension methods for initial data:
SeedRoles— Seeds anAdministratorroleSeedRolePermissions— GrantsPermissions.Allon theAuthscope to the Administrator roleSeedUsers— Seedsadmin@test.comwith passwordTest1234SeedUserRoles— Assigns the Administrator role to the seeded user
Migration Commands
# Create migration
dotnet ef migrations add <Name> --project ./Src/Auth/AugusteVN.Modules.Auth.Database --startup-project <YourStartupProject> --context AuthDbContext
# Apply migrations
dotnet ef database update --project ./Src/Auth/AugusteVN.Modules.Auth.Database --startup-project <YourStartupProject> --context AuthDbContext
Installation
dotnet add package AugusteVN.Modules.Auth.Database
Full Documentation
See the Auth Module README for complete documentation.
Merged Domain Documentation
AugusteVN.Modules.Auth.Database
Domain entities and shared interfaces for the Auth module — defines the contracts consumed by the EfCore persistence layer.
Contracts
IAuthUser
public interface IAuthUser : IIdentifiableEntity<string>
{
string? Email { get; set; }
bool EmailConfirmed { get; set; }
string? Name { get; set; }
string? UserName { get; set; }
string? PhoneNumber { get; set; }
string? PasswordHash { get; set; }
DateTime CreatedAt { get; set; }
}
Provider-agnostic user abstraction implemented by the persistence layers.
IAuthRole
public interface IAuthRole : IIdentifiableEntity<string>
{
string? Name { get; set; }
string? Description { get; set; }
string? Type { get; set; }
DateTime CreatedAt { get; set; }
DateTime? LastModifiedAt { get; set; }
string? LastModifiedBy { get; set; }
IEnumerable<RolePermission>? Permissions { get; set; }
}
IAuthDbContext
public interface IAuthDbContext
{
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
Entities
RolePermission (extends AuditableEntity)
| Property | Type | Description |
|---|---|---|
Id |
Guid |
Primary key (inherited) |
Scope |
string |
Module scope (e.g. Auth) |
Sum |
int |
Bit-flag sum of granted permissions |
RoleId |
string |
Owning role id |
Dependencies
AugusteVN.Database.Entities
Installation
dotnet add package AugusteVN.Modules.Auth.Database
Full Documentation
See the Auth Module README for complete documentation.
| 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
- AugusteVN.Database.EFCore (>= 1.1.4)
- AugusteVN.Modules.Auth._Shared (>= 1.0.9)
- Microsoft.AspNetCore.Identity.EntityFrameworkCore (>= 10.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.0)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on AugusteVN.Modules.Auth.Database:
| Package | Downloads |
|---|---|
|
AugusteVN.Modules.Auth.Api
Minimal API endpoints for authentication, identity, roles, and user management |
|
|
AugusteVN.Modules.Auth.Features
Shared CQRS handlers for authentication, roles, and user management |
GitHub repositories
This package is not used by any popular GitHub repositories.