21 lines
753 B
C#
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);
|
|||
|
|
}
|
|||
|
|
}
|