namespace SimpleLIS; using Microsoft.EntityFrameworkCore; using SimpleLIS.Models; public class HL7DbContext : DbContext { public DbSet Messages { get; set; } public DbSet Patients { get; set; } public DbSet Observations { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Data Source=hl7.db"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasKey(m => m.MessageId); modelBuilder.Entity() .HasKey(p => p.PatientId); modelBuilder.Entity() .HasKey(o => o.ObservationId); modelBuilder.Entity() .HasMany(m => m.Observations) .WithOne(o => o.Message) .HasForeignKey(o => o.MessageId); } }