begin: PHI Column Encryption
This commit is contained in:
@@ -2,7 +2,14 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
private readonly IPhiEncryptionService? _phiCrypto;
|
||||
|
||||
public AppDbContext(
|
||||
DbContextOptions<AppDbContext> options,
|
||||
IPhiEncryptionService? phiCrypto = null) : base(options)
|
||||
{
|
||||
_phiCrypto = phiCrypto;
|
||||
}
|
||||
|
||||
public DbSet<Patient> Patients => Set<Patient>();
|
||||
public DbSet<Encounter> Encounters => Set<Encounter>();
|
||||
@@ -21,9 +28,13 @@ public class AppDbContext : DbContext
|
||||
public DbSet<ExternalResourceIdentifier> ExternalResourceIdentifiers => Set<ExternalResourceIdentifier>();
|
||||
public DbSet<ClinicalUser> ClinicalUsers => Set<ClinicalUser>();
|
||||
public DbSet<ClinicalAuditLog> ClinicalAuditLogs => Set<ClinicalAuditLog>();
|
||||
public DbSet<PhiAccessLog> PhiAccessLogs => Set<PhiAccessLog>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
|
||||
|
||||
if (_phiCrypto is not null)
|
||||
modelBuilder.ConfigurePhiConverters(_phiCrypto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user