using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace Connect_with_base.Models; public partial class _43pBezaevaContext : DbContext { public _43pBezaevaContext() { } public _43pBezaevaContext(DbContextOptions<_43pBezaevaContext> options) : base(options) { } public virtual DbSet Courses { get; set; } public virtual DbSet Disciplines { get; set; } public virtual DbSet Genders { get; set; } public virtual DbSet Teachers { get; set; } public virtual DbSet TeacherCourses { get; set; } public virtual DbSet TeacherDisciplines { 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.local;Port=5432;Database=43P_Bezaeva;Username=43P;Password=444444"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("courses_pkey"); entity.ToTable("courses"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .HasMaxLength(100) .HasColumnName("name"); entity.Property(e => e.Time) .HasMaxLength(50) .HasColumnName("time"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("disciplines_pkey"); entity.ToTable("disciplines"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .HasMaxLength(100) .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("genders_pkey"); entity.ToTable("genders"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.GenderName) .HasMaxLength(10) .HasColumnName("gender_name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("teachers_pkey"); entity.ToTable("teachers"); entity.HasIndex(e => e.Email, "teachers_email_key").IsUnique(); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.DateOfBirth) .HasColumnType("timestamp without time zone") .HasColumnName("date_of_birth"); entity.Property(e => e.Email) .HasMaxLength(100) .HasColumnName("email"); entity.Property(e => e.Experience).HasColumnName("experience"); entity.Property(e => e.FirstName) .HasMaxLength(50) .HasColumnName("first_name"); entity.Property(e => e.GenderId).HasColumnName("gender_id"); entity.Property(e => e.LastName) .HasMaxLength(50) .HasColumnName("last_name"); entity.Property(e => e.PatronymicName) .HasMaxLength(50) .HasColumnName("patronymic_name"); entity.Property(e => e.Phone) .HasMaxLength(25) .HasColumnName("phone"); entity.HasOne(d => d.Gender).WithMany(p => p.Teachers) .HasForeignKey(d => d.GenderId) .HasConstraintName("fk_gender"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("teacher_course_pkey"); entity.ToTable("teacher_course"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.CourseId).HasColumnName("course_id"); entity.Property(e => e.TeacherId).HasColumnName("teacher_id"); entity.HasOne(d => d.Course).WithMany(p => p.TeacherCourses) .HasForeignKey(d => d.CourseId) .HasConstraintName("fk_course"); entity.HasOne(d => d.Teacher).WithMany(p => p.TeacherCourses) .HasForeignKey(d => d.TeacherId) .HasConstraintName("fk_teacher"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("teacher_disciplines_pkey"); entity.ToTable("teacher_disciplines"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.DisciplineId).HasColumnName("discipline_id"); entity.Property(e => e.TeacherId).HasColumnName("teacher_id"); entity.HasOne(d => d.Discipline).WithMany(p => p.TeacherDisciplines) .HasForeignKey(d => d.DisciplineId) .HasConstraintName("fk_disciplines"); entity.HasOne(d => d.Teacher).WithMany(p => p.TeacherDisciplines) .HasForeignKey(d => d.TeacherId) .HasConstraintName("fk_teacher"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }