using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace pr13.Models; public partial class PostgresContext : DbContext { public PostgresContext() { } public PostgresContext(DbContextOptions options) : base(options) { } public virtual DbSet Courses { get; set; } public virtual DbSet Genders { get; set; } public virtual DbSet Roles { get; set; } public virtual DbSet Teachers { get; set; } public virtual DbSet TeachersCourses { get; set; } public virtual DbSet Users { 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=Smirnov2;Username=43P;Password=444444"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasPostgresExtension("pg_catalog", "adminpack"); modelBuilder.Entity(entity => { entity.HasKey(e => e.Idcurs).HasName("newtable_pk"); entity.ToTable("courses"); entity.Property(e => e.Idcurs) .UseIdentityAlwaysColumn() .HasColumnName("idcurs"); entity.Property(e => e.Course1) .HasColumnType("character varying") .HasColumnName("curs"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("genders_pk"); entity.ToTable("gender"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("idgender"); entity.Property(e => e.Gender1) .HasColumnType("character varying") .HasColumnName("namegender"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdRole).HasName("roles_pk"); entity.ToTable("roles"); entity.Property(e => e.IdRole) .UseIdentityAlwaysColumn() .HasColumnName("id_role"); entity.Property(e => e.Role1) .HasColumnType("character varying") .HasColumnName("role"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTeacher).HasName("teachers_pk"); entity.ToTable("teachers"); entity.Property(e => e.IdTeacher) .ValueGeneratedOnAdd() .UseIdentityAlwaysColumn() .HasColumnName("idteacher"); entity.Property(e => e.Birthdate) .HasColumnType("timestamp without time zone") .HasColumnName("dr"); entity.Property(e => e.Email) .HasColumnType("character varying") .HasColumnName("mail"); entity.Property(e => e.Expirience).HasColumnName("stash"); entity.Property(e => e.IdGender).HasColumnName("idgender"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); entity.Property(e => e.Patronymic) .HasColumnType("character varying") .HasColumnName("otchestvo"); entity.Property(e => e.Phone) .HasColumnType("character varying") .HasColumnName("phone"); entity.Property(e => e.Surname) .HasColumnType("character varying") .HasColumnName("familia"); entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.Teachers) .HasForeignKey(d => d.IdGender) .HasConstraintName("teacher_fk"); entity.HasOne(d => d.IdTeacherNavigation).WithOne(p => p.Teacher) .HasForeignKey(d => d.IdTeacher) .HasConstraintName("teacher_fk1"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("teachers_courses_pk"); entity.ToTable("teachers_courses"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Hours).HasColumnName("time"); entity.Property(e => e.IdCourse).HasColumnName("idcurs"); entity.Property(e => e.IdTeacher).HasColumnName("idteacher"); entity.HasOne(d => d.IdCourseNavigation).WithMany(p => p.TeachersCourses) .HasForeignKey(d => d.IdCourse) .HasConstraintName("teachers_courses_fk_1"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TeachersCourses) .HasForeignKey(d => d.IdTeacher) .HasConstraintName("teachers_courses_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdUser).HasName("users_pk"); entity.ToTable("users"); entity.Property(e => e.IdUser) .UseIdentityAlwaysColumn() .HasColumnName("iduser"); entity.Property(e => e.IdRole).HasColumnName("idrol"); entity.Property(e => e.Login) .HasColumnType("character varying") .HasColumnName("login"); entity.Property(e => e.Password) .HasColumnType("character varying") .HasColumnName("parol"); entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Users) .HasForeignKey(d => d.IdRole) .HasConstraintName("users_fk"); }); modelBuilder.HasSequence("courses_id_seq").HasMax(2147483647L); modelBuilder.HasSequence("genders_id_seq").HasMax(2147483647L); modelBuilder.HasSequence("roles_id_role_seq").HasMax(2147483647L); modelBuilder.HasSequence("teachers_courses_id_seq").HasMax(2147483647L); modelBuilder.HasSequence("teachers_id_seq").HasMax(2147483647L); modelBuilder.HasSequence("users_id_user_seq").HasMax(2147483647L); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }