using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace N11_1.Models; public partial class _43pKotkovaContext : DbContext { public _43pKotkovaContext() { } public _43pKotkovaContext(DbContextOptions<_43pKotkovaContext> options) : base(options) { } public virtual DbSet TbCourses { get; set; } public virtual DbSet TbGenders { get; set; } public virtual DbSet TbLessons { get; set; } public virtual DbSet TbTeachers { get; set; } public virtual DbSet TbTeachersCourses { get; set; } public virtual DbSet TbTeachersLessons { 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 http://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=43P_Kotkova;Username=43P;Password=444444"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_courses_pk"); entity.ToTable("tb_courses"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_gender_pk"); entity.ToTable("tb_gender"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_lesson_pk"); entity.ToTable("tb_lesson"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_teachers_pk"); entity.ToTable("tb_teachers"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.DateOf) .HasColumnType("timestamp without time zone") .HasColumnName("date_of"); entity.Property(e => e.Email) .HasColumnType("character varying") .HasColumnName("email"); entity.Property(e => e.FirstName) .HasColumnType("character varying") .HasColumnName("first_name"); entity.Property(e => e.IdGender).HasColumnName("id_gender"); entity.Property(e => e.LastName) .HasColumnType("character varying") .HasColumnName("last_name"); entity.Property(e => e.Patronymic) .HasColumnType("character varying") .HasColumnName("patronymic"); entity.Property(e => e.Phone) .HasColumnType("character varying") .HasColumnName("phone"); entity.Property(e => e.WorkExperience).HasColumnName("work_experience"); entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.TbTeachers) .HasForeignKey(d => d.IdGender) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tb_teachers_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_teachers_courses_pk"); entity.ToTable("tb_teachers_courses"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Hours).HasColumnName("hours"); entity.Property(e => e.IdCourses).HasColumnName("id_courses"); entity.Property(e => e.IdTeacher).HasColumnName("id_teacher"); entity.HasOne(d => d.IdCoursesNavigation).WithMany(p => p.TbTeachersCourses) .HasForeignKey(d => d.IdCourses) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tb_teachers_courses_fk_1"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TbTeachersCourses) .HasForeignKey(d => d.IdTeacher) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tb_teachers_courses_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tb_teachers_lessons_pk"); entity.ToTable("tb_teachers_lessons"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdLesson).HasColumnName("id_lesson"); entity.Property(e => e.IdTeacher).HasColumnName("id_teacher"); entity.HasOne(d => d.IdLessonNavigation).WithMany(p => p.TbTeachersLessons) .HasForeignKey(d => d.IdLesson) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tb_teachers_lessons_fk_1"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TbTeachersLessons) .HasForeignKey(d => d.IdTeacher) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tb_teachers_lessons_fk"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }