using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using ScadaLink.Commons.Entities.Audit; using ScadaLink.Commons.Entities.Deployment; using ScadaLink.Commons.Entities.ExternalSystems; using ScadaLink.Commons.Entities.InboundApi; using ScadaLink.Commons.Entities.Instances; using ScadaLink.Commons.Entities.Notifications; using ScadaLink.Commons.Entities.Scripts; using ScadaLink.Commons.Entities.Security; using ScadaLink.Commons.Entities.Sites; using ScadaLink.Commons.Entities.Templates; namespace ScadaLink.ConfigurationDatabase; public class ScadaLinkDbContext : DbContext, IDataProtectionKeyContext { private readonly IDataProtectionProvider? _dataProtectionProvider; public ScadaLinkDbContext(DbContextOptions options) : base(options) { } /// /// Creates a context with an explicit Data Protection provider used to encrypt /// secret-bearing configuration columns at rest. The runtime resolves this overload /// via DI; design-time tooling uses the single-argument overload. /// public ScadaLinkDbContext(DbContextOptions options, IDataProtectionProvider dataProtectionProvider) : base(options) { _dataProtectionProvider = dataProtectionProvider ?? throw new ArgumentNullException(nameof(dataProtectionProvider)); } // Templates public DbSet