123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaTeachersDB.Models;
- public partial class _43pToropovaContext : DbContext
- {
- public _43pToropovaContext()
- {
- }
- public _43pToropovaContext(DbContextOptions<_43pToropovaContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Course> Courses { get; set; }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<SchoolSubject> SchoolSubjects { get; set; }
- public virtual DbSet<Teacher> Teachers { get; set; }
- public virtual DbSet<TeacherCourse> TeacherCourses { get; set; }
- public virtual DbSet<TeachersSubject> TeachersSubjects { 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_Toropova;Username=43P;Password=444444");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Course>(entity =>
- {
- entity.HasKey(e => e.IdCourses).HasName("courses_pk");
- entity.ToTable("courses");
- entity.Property(e => e.IdCourses)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_courses");
- entity.Property(e => e.NameCourses)
- .HasColumnType("character varying")
- .HasColumnName("name_courses");
- });
- modelBuilder.Entity<Gender>(entity =>
- {
- entity.HasKey(e => e.IdGender).HasName("genders_pk");
- entity.ToTable("genders");
- entity.Property(e => e.IdGender)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_gender");
- entity.Property(e => e.NameGender)
- .HasColumnType("character varying")
- .HasColumnName("name_gender");
- });
- modelBuilder.Entity<SchoolSubject>(entity =>
- {
- entity.HasKey(e => e.IdSubjects).HasName("school_subjects_pk");
- entity.ToTable("school_subjects");
- entity.Property(e => e.IdSubjects)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_subjects");
- entity.Property(e => e.NameSubjects)
- .HasColumnType("character varying")
- .HasColumnName("name__subjects");
- });
- modelBuilder.Entity<Teacher>(entity =>
- {
- entity.HasKey(e => e.IdTeachers).HasName("teachers_pk");
- entity.ToTable("teachers");
- entity.Property(e => e.IdTeachers)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_teachers");
- entity.Property(e => e.BirthdayTeacher).HasColumnName("birthday_teacher");
- entity.Property(e => e.ExperienceTeacher).HasColumnName("experience_teacher");
- entity.Property(e => e.IdGender).HasColumnName("id_gender");
- entity.Property(e => e.Mail)
- .HasColumnType("character varying")
- .HasColumnName("mail");
- entity.Property(e => e.NameTeacher)
- .HasColumnType("character varying")
- .HasColumnName("name_teacher");
- entity.Property(e => e.PatronymicTeacher)
- .HasColumnType("character varying")
- .HasColumnName("patronymic_teacher");
- entity.Property(e => e.Phone)
- .HasColumnType("character varying")
- .HasColumnName("phone");
- entity.Property(e => e.SurnameTeacher)
- .HasColumnType("character varying")
- .HasColumnName("surname_teacher");
- entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.Teachers)
- .HasForeignKey(d => d.IdGender)
- .HasConstraintName("teachers_fk");
- });
- modelBuilder.Entity<TeacherCourse>(entity =>
- {
- entity.HasKey(e => e.IdTeacherCourse).HasName("teacher_courses_pk");
- entity.ToTable("teacher_courses");
- entity.Property(e => e.IdTeacherCourse)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_teacher_course");
- entity.Property(e => e.IdCourse).HasColumnName("id_course");
- entity.Property(e => e.IdTeacher).HasColumnName("id_teacher");
- entity.Property(e => e.TimeHours).HasColumnName("time_hours");
- entity.HasOne(d => d.IdCourseNavigation).WithMany(p => p.TeacherCourses)
- .HasForeignKey(d => d.IdCourse)
- .HasConstraintName("teacher_courses_fk");
- entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TeacherCourses)
- .HasForeignKey(d => d.IdTeacher)
- .HasConstraintName("teacher_courses_fk_1");
- });
- modelBuilder.Entity<TeachersSubject>(entity =>
- {
- entity.HasKey(e => e.IdTeacherSubjects).HasName("teachers_subjects_pk");
- entity.ToTable("teachers_subjects");
- entity.Property(e => e.IdTeacherSubjects)
- .UseIdentityAlwaysColumn()
- .HasColumnName("id_teacher_subjects");
- entity.Property(e => e.IdSubjects).HasColumnName("id_subjects");
- entity.Property(e => e.IdTeacher).HasColumnName("id_teacher");
- entity.HasOne(d => d.IdSubjectsNavigation).WithMany(p => p.TeachersSubjects)
- .HasForeignKey(d => d.IdSubjects)
- .HasConstraintName("teachers_subjects_fk_1");
- entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.TeachersSubjects)
- .HasForeignKey(d => d.IdTeacher)
- .HasConstraintName("teachers_subjects_fk");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|