using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace Teachers.Models; public partial class _43pTryaninaContext : DbContext { public _43pTryaninaContext() { } public _43pTryaninaContext(DbContextOptions<_43pTryaninaContext> options) : base(options) { } public virtual DbSet Courses { get; set; } public virtual DbSet Genders { get; set; } public virtual DbSet Subjects { get; set; } public virtual DbSet SubjectsTaughts { get; set; } public virtual DbSet Teachers { get; set; } public virtual DbSet TeacherCourses { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.ru;Port=5442;Database=43P_Tryanina;Username=43P;Password=444444"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("subjects_pk_1"); entity.ToTable("courses"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Duration).HasColumnName("duration"); entity.Property(e => e.Name) .HasMaxLength(100) .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("genders_pk"); entity.ToTable("genders"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Gender1) .HasMaxLength(10) .HasColumnName("gender"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("subjects_pk"); entity.ToTable("subjects"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .HasMaxLength(50) .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdSt).HasName("subjects_taught_pk"); entity.ToTable("subjects_taught"); entity.Property(e => e.IdSt).HasColumnName("id_st"); entity.Property(e => e.IdSubject) .ValueGeneratedOnAdd() .HasColumnName("id_subject"); entity.Property(e => e.IdTeacher) .ValueGeneratedOnAdd() .HasColumnName("id_teacher"); entity.HasOne(d => d.IdSubjectNavigation).WithMany(p => p.SubjectsTaughts) .HasForeignKey(d => d.IdSubject) .HasConstraintName("subjects_taught_subjects_fk"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.SubjectsTaughts) .HasForeignKey(d => d.IdTeacher) .HasConstraintName("subjects_taught_teachers_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("teachers_pk"); entity.ToTable("teachers"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Birthday) .HasColumnType("timestamp without time zone") .HasColumnName("birthday"); entity.Property(e => e.Email) .HasMaxLength(100) .HasColumnName("email"); entity.Property(e => e.Experience).HasColumnName("experience"); entity.Property(e => e.Gender) .HasDefaultValue(1) .HasColumnName("gender"); entity.Property(e => e.Name) .HasMaxLength(20) .HasColumnName("name"); entity.Property(e => e.Patronymic) .HasMaxLength(20) .HasColumnName("patronymic"); entity.Property(e => e.Phone) .HasMaxLength(25) .HasColumnName("phone"); entity.Property(e => e.Surname) .HasMaxLength(20) .HasColumnName("surname"); entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Teachers) .HasForeignKey(d => d.Gender) .HasConstraintName("teachers_genders_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTc).HasName("teacher_courses_pk"); entity.ToTable("teacher_courses"); entity.Property(e => e.IdTc).HasColumnName("id_tc"); entity.Property(e => e.IdCourse) .ValueGeneratedOnAdd() .HasColumnName("id_course"); entity.Property(e => e.IdTeacher) .ValueGeneratedOnAdd() .HasColumnName("id_teacher"); entity.HasOne(d => d.IdCourseNavigation).WithMany(p => p.TeacherCourses) .HasForeignKey(d => d.IdCourse) .HasConstraintName("teacher_courses_courses_fk"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TeacherCourses) .HasForeignKey(d => d.IdTeacher) .HasConstraintName("teacher_courses_teachers_fk"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }