using data.DAO; using Microsoft.EntityFrameworkCore; namespace data; public class DatabaseContext : DbContext { public DatabaseContext() { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5454;Username=user13;Password=keNBA0yK"); public DbSet Students { get; set; } public DbSet Groups { get; set; } public DbSet Diaries { get; set; } public DbSet Subjects { get; set; } public DbSet Traffics { get; set; } public DbSet StudentGroupsSubjects { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().Property(it => it.Id).ValueGeneratedOnAdd(); modelBuilder.Entity() .HasOne(it => it.Group); modelBuilder.Entity() .HasOne(it => it.StudentGroupSubject); modelBuilder.Entity() .HasOne(it => it.Traffic); modelBuilder.Entity() .HasOne(it => it.Student); modelBuilder.Entity() .HasOne(it => it.Group); modelBuilder.Entity() .HasOne(it => it.Subject); } }