diff --git a/src/ScadaLink.ConfigurationDatabase/ServiceCollectionExtensions.cs b/src/ScadaLink.ConfigurationDatabase/ServiceCollectionExtensions.cs index d926f1e..62266ec 100644 --- a/src/ScadaLink.ConfigurationDatabase/ServiceCollectionExtensions.cs +++ b/src/ScadaLink.ConfigurationDatabase/ServiceCollectionExtensions.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using ScadaLink.Commons.Interfaces; using ScadaLink.Commons.Interfaces.Repositories; using ScadaLink.Commons.Interfaces.Services; +using ScadaLink.Commons.Interfaces.Transport; using ScadaLink.ConfigurationDatabase.Maintenance; using ScadaLink.ConfigurationDatabase.Repositories; using ScadaLink.ConfigurationDatabase.Services; @@ -51,6 +52,7 @@ public static class ServiceCollectionExtensions services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/src/ScadaLink.ConfigurationDatabase/Services/AuditCorrelationContext.cs b/src/ScadaLink.ConfigurationDatabase/Services/AuditCorrelationContext.cs new file mode 100644 index 0000000..180cdb3 --- /dev/null +++ b/src/ScadaLink.ConfigurationDatabase/Services/AuditCorrelationContext.cs @@ -0,0 +1,14 @@ +using ScadaLink.Commons.Interfaces.Transport; + +namespace ScadaLink.ConfigurationDatabase.Services; + +/// +/// Per-scope mutable holder for the active bundle import id. AuditService reads it +/// while writing AuditLogEntry rows. Registered as Scoped so each Blazor circuit / +/// request gets its own value; ApplyAsync explicitly creates a service scope and +/// sets the id at the top of the transaction. +/// +public sealed class AuditCorrelationContext : IAuditCorrelationContext +{ + public Guid? BundleImportId { get; set; } +}