123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- 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<TbCourse> TbCourses { get; set; }
- public virtual DbSet<TbGender> TbGenders { get; set; }
- public virtual DbSet<TbLesson> TbLessons { get; set; }
- public virtual DbSet<TbTeacher> TbTeachers { get; set; }
- public virtual DbSet<TbTeachersCourse> TbTeachersCourses { get; set; }
- public virtual DbSet<TbTeachersLesson> 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<TbCourse>(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<TbGender>(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<TbLesson>(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<TbTeacher>(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<TbTeachersCourse>(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<TbTeachersLesson>(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);
- }
|