Files
HeadgearViewingRange3M/Helpers/AppDbContext.cs
2026-03-24 20:40:26 +08:00

21 lines
753 B
C#

using Microsoft.EntityFrameworkCore;
public class AppDbContext : DbContext
{
public DbSet<BubblePointEntity> BubblePointRecords { get; set; }
public DbSet<PoreDistributionEntity> PoreDistributionRecords { get; set; }
public DbSet<DataPointEntity> DataPoints { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite("Data Source=membrane_test.db");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<PoreDistributionEntity>()
.HasMany(p => p.DataPoints)
.WithOne(d => d.PoreDistribution)
.HasForeignKey(d => d.PoreDistributionId)
.OnDelete(DeleteBehavior.Cascade);
}
}