123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using System.Collections.Generic;
- using AvaloniaApplication5.Models;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaApplication5;
- public partial class _43pBezaevaContext : DbContext
- {
- public _43pBezaevaContext()
- {
- }
- public _43pBezaevaContext(DbContextOptions<_43pBezaevaContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Course> Courses { get; set; }
- public virtual DbSet<Discipline> Disciplines { get; set; }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<Teacher> Teachers { get; set; }
- public virtual DbSet<TeacherCourse> TeacherCourses { get; set; }
- public virtual DbSet<TeacherDiscipline> 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<Course>(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<Discipline>(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<Gender>(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<Teacher>(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<TeacherCourse>(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<TeacherDiscipline>(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);
- }
|