NovusCore.AuditService.ChangeTracking
1.0.0
dotnet add package NovusCore.AuditService.ChangeTracking --version 1.0.0
NuGet\Install-Package NovusCore.AuditService.ChangeTracking -Version 1.0.0
<PackageReference Include="NovusCore.AuditService.ChangeTracking" Version="1.0.0" />
<PackageVersion Include="NovusCore.AuditService.ChangeTracking" Version="1.0.0" />
<PackageReference Include="NovusCore.AuditService.ChangeTracking" />
paket add NovusCore.AuditService.ChangeTracking --version 1.0.0
#r "nuget: NovusCore.AuditService.ChangeTracking, 1.0.0"
#:package NovusCore.AuditService.ChangeTracking@1.0.0
#addin nuget:?package=NovusCore.AuditService.ChangeTracking&version=1.0.0
#tool nuget:?package=NovusCore.AuditService.ChangeTracking&version=1.0.0
AuditService.ChangeTracking
EF Core change tracking and audit interceptor for RetireAix microservices.
Features
- Automatic audit trail for EF Core entities (Add/Modify/Delete)
- Captures user context, IP address, request path, and trace ID
- Publishes audit events to AWS SQS with retry logic
- Batch publishing support for performance
- Configurable entity and property filtering
- Zero-code integration with EF Core SaveChanges
Installation
dotnet add package AuditService.ChangeTracking
Usage
1. Configure in appsettings.json
{
"Audit": {
"SourceService": "PlanSponsorService",
"QueueUrl": "********",
"AwsRegion": "********",
"AwsAccessKeyId": "******",
"AwsSecretAccessKey": "******",
"Enabled": true,
"MaxRetryAttempts": 3,
"RetryDelayMilliseconds": 100,
"IgnoredEntities": ["AuditLog", "Session"],
"IgnoredProperties": ["CreatedAt", "UpdatedAt", "ModifiedAt"]
}
}
For Production (using IAM Roles):
{
"Audit": {
"SourceService": "PlanSponsorService",
"QueueUrl": "https://sqs.us-east-1.amazonaws.com/266735844636/prod-retireaix-audit-events-queue",
"AwsRegion": "us-east-1",
"Enabled": true
}
}
Note: In production, omit AwsAccessKeyId and AwsSecretAccessKey to use IAM role credentials.
2. Register in Program.cs
using AuditService.ChangeTracking.Extensions;
builder.Services.AddAuditChangeTracking(builder.Configuration);
3. Add Interceptor to DbContext
public class MyDbContext : DbContext
{
private readonly IServiceProvider _serviceProvider;
public MyDbContext(DbContextOptions<MyDbContext> options, IServiceProvider serviceProvider)
: base(options)
{
_serviceProvider = serviceProvider;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.AddAuditInterceptor(_serviceProvider);
base.OnConfiguring(optionsBuilder);
}
}
Configuration Options
- SourceService: Name of the microservice (required)
- QueueUrl: AWS SQS queue URL (required)
- AwsRegion: AWS region (optional, defaults to SDK default)
- AwsAccessKeyId: AWS Access Key ID (optional, for local dev only)
- AwsSecretAccessKey: AWS Secret Access Key (optional, for local dev only)
- AwsServiceUrl: Custom AWS endpoint for LocalStack (optional)
- Enabled: Enable/disable audit tracking (default: true)
- MaxRetryAttempts: Number of retry attempts for failed publishes (default: 3)
- RetryDelayMilliseconds: Delay between retries in milliseconds (default: 100)
- BatchSize: Maximum batch size for SQS (1-10, default: 10)
- IgnoredEntities: List of entity names to exclude from audit
- IgnoredProperties: List of property names to exclude from audit
Authentication
Local Development
Provide explicit AWS credentials in appsettings.json:
{
"Audit": {
"AwsAccessKeyId": "your-access-key",
"AwsSecretAccessKey": "your-secret-key"
}
}
Production
Omit credentials to use AWS IAM roles (recommended):
- ECS/Fargate: Task execution role
- EKS: IRSA (IAM Roles for Service Accounts)
- EC2: Instance profile
The SDK will automatically use the IAM role attached to your container/pod.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
-
net8.0
- AWSSDK.SQS (>= 3.7.502.22)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.EntityFrameworkCore (>= 8.0.22)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 8.0.0)
- NovusCore.AuditService.Contracts (>= 1.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NovusCore.AuditService.ChangeTracking:
| Package | Downloads |
|---|---|
|
NovusCore.Shared.Data
Shared data access layer combining domain entities and database infrastructure for RetireAix microservices. Includes PlanSponsor entities (29 entities across app, plan, and action schemas) with stored procedures and functions. BREAKING CHANGE: AuditableEntity user IDs changed from string to int. |
|
|
RetireAix.Shared.Data
Shared data access layer combining domain entities and database infrastructure for RetireAix microservices. Includes PlanSponsor entities (29 entities across app, plan, and action schemas) with stored procedures and functions. BREAKING CHANGE: AuditableEntity user IDs changed from string to int. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 637 | 12/31/2025 |