123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace YtYtAvalonia.Models;
- public partial class SuharevaContext : DbContext
- {
- public SuharevaContext()
- {
- }
- public SuharevaContext(DbContextOptions<SuharevaContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Availability> Availabilities { get; set; }
- public virtual DbSet<Course> Courses { get; set; }
- public virtual DbSet<User> Users { get; set; }
- public virtual DbSet<UserAndCourse> UserAndCourses { 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.ru;Port=5442;Database=Suhareva;Username=33P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Availability>(entity =>
- {
- entity.HasKey(e => e.Availabilityid).HasName("Availability_pkey");
- entity.ToTable("Availability");
- entity.Property(e => e.Availabilityid)
- .UseIdentityAlwaysColumn()
- .HasColumnName("availabilityid");
- entity.Property(e => e.Title)
- .HasMaxLength(50)
- .HasColumnName("title");
- });
- modelBuilder.Entity<Course>(entity =>
- {
- entity.HasKey(e => e.Courseid).HasName("Course_pkey");
- entity.ToTable("Course");
- entity.Property(e => e.Courseid)
- .UseIdentityAlwaysColumn()
- .HasColumnName("courseid");
- entity.Property(e => e.Availability).HasColumnName("availability");
- entity.Property(e => e.Price).HasColumnName("price");
- entity.Property(e => e.Title)
- .HasMaxLength(50)
- .HasColumnName("title");
- entity.HasOne(d => d.AvailabilityNavigation).WithMany(p => p.Courses)
- .HasForeignKey(d => d.Availability)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("Course_availability_fkey");
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.Userid).HasName("User_pkey");
- entity.ToTable("User");
- entity.Property(e => e.Userid)
- .UseIdentityAlwaysColumn()
- .HasColumnName("userid");
- entity.Property(e => e.Bithday).HasColumnName("bithday");
- entity.Property(e => e.Email)
- .HasMaxLength(50)
- .HasColumnName("email");
- entity.Property(e => e.Login)
- .HasMaxLength(50)
- .HasColumnName("login");
- entity.Property(e => e.Name).HasMaxLength(50);
- entity.Property(e => e.Password).HasMaxLength(50);
- entity.Property(e => e.Patronymic)
- .HasMaxLength(50)
- .HasColumnName("patronymic");
- entity.Property(e => e.Phonenumber).HasColumnName("phonenumber");
- entity.Property(e => e.Surname)
- .HasMaxLength(50)
- .HasColumnName("surname");
- });
- modelBuilder.Entity<UserAndCourse>(entity =>
- {
- entity
- .HasNoKey()
- .ToTable("UserAndCourse");
- entity.Property(e => e.Courseid).HasColumnName("courseid");
- entity.Property(e => e.Userid).HasColumnName("userid");
- entity.HasOne(d => d.Course).WithMany()
- .HasForeignKey(d => d.Courseid)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("UserAndCourse_courseid_fkey");
- entity.HasOne(d => d.User).WithMany()
- .HasForeignKey(d => d.Userid)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("UserAndCourse_userid_fkey");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|