ApplicationDbContext.cs
1 using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 2 using Microsoft.EntityFrameworkCore; 3 using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 4 5 namespace _5uhr.Data; 6 7 public class ApplicationDbContext : IdentityDbContext 8 { 9 public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) 10 : base(options) 11 { 12 } 13 14 public virtual DbSet<Member> Member { get; set; } = default!; 15 public virtual DbSet<CheckIn> CheckIn { get; set; } = default!; 16 public virtual DbSet<Verification> Verifications { get; set; } = default!; 17 public virtual DbSet<Report> Reports { get; set; } = default!; 18 public virtual DbSet<Configuration> Configurations { get; set; } = default!; 19 public virtual DbSet<GangDay> Days { get; set; } = default!; 20 public virtual DbSet<PreCheckIn> PreCheckIns { get; set; } = default!; 21 22 protected override void OnModelCreating(ModelBuilder builder) 23 { 24 base.OnModelCreating(builder); 25 builder.Entity<GangDay>() 26 .HasOne(x => x.Next) 27 .WithOne(x => x.Previous); 28 } 29 }