using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace YtYtAvalonia.Models; public partial class SuharevaContext : DbContext { public SuharevaContext() { } public SuharevaContext(DbContextOptions options) : base(options) { } public virtual DbSet Availabilities { get; set; } public virtual DbSet Courses { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet 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(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(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(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(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); }