Ling.Audit.AspNetCore
2.2.2
dotnet add package Ling.Audit.AspNetCore --version 2.2.2
NuGet\Install-Package Ling.Audit.AspNetCore -Version 2.2.2
<PackageReference Include="Ling.Audit.AspNetCore" Version="2.2.2" />
<PackageVersion Include="Ling.Audit.AspNetCore" Version="2.2.2" />
<PackageReference Include="Ling.Audit.AspNetCore" />
paket add Ling.Audit.AspNetCore --version 2.2.2
#r "nuget: Ling.Audit.AspNetCore, 2.2.2"
#:package Ling.Audit.AspNetCore@2.2.2
#addin nuget:?package=Ling.Audit.AspNetCore&version=2.2.2
#tool nuget:?package=Ling.Audit.AspNetCore&version=2.2.2
Ling.Audit.AspNetCore
ASP.NET Core request-context integration for Ling.Audit.EntityFrameworkCore.
This package resolves the current user from HttpContext.User and supplies user ID, user name, remote IP address, and a bounded client name to the EF Core audit pipeline. It does not invoke authentication itself.
Installation
dotnet add package Ling.Audit.AspNetCore
Quick start
builder.Services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(connectionString);
options.UseAspNetCoreAudit(http =>
{
http.UserIdClaimType = "sub";
http.UserNameClaimType = "name";
http.MaxClientNameLength = 256;
});
});
The default principal resolver prefers explicit claim-type settings, then ASP.NET Core Identity claim settings, the authenticated identity's Name, and common name identifier/sub fallbacks. Register an IAuditPrincipalResolver when the application uses custom claims, multiple identities, or a non-standard selection rule.
public sealed class TenantPrincipalResolver : IAuditPrincipalResolver
{
public AuditPrincipal Resolve(HttpContext context) => new(
context.User.FindFirst("employee_id")?.Value,
context.User.Identity?.Name);
}
options.UseAspNetCoreAudit<TenantPrincipalResolver>();
The integration uses string user IDs. Applications using Guid, int, or another key type can configure Ling.Audit.EntityFrameworkCore directly with a matching user provider.
Related package
This package depends on Ling.Audit.EntityFrameworkCore, which provides the EF Core model configuration and audit persistence behavior.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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 is compatible. 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 is compatible. 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 is compatible. 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 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. net11.0 is compatible. |
-
net10.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
-
net11.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
-
net6.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
-
net7.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
-
net8.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
-
net9.0
- Ling.Audit.EntityFrameworkCore (>= 2.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.