123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace reactivepril.Models;
- public partial class Galochkin41pContext : DbContext
- {
- public Galochkin41pContext()
- {
- }
- public Galochkin41pContext(DbContextOptions<Galochkin41pContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<Image> Images { get; set; }
- public virtual DbSet<Role> Roles { get; set; }
- public virtual DbSet<User> Users { 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=galochkin41p;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Gender>(entity =>
- {
- entity.HasKey(e => e.IdGender).HasName("gender_pkey");
- entity.ToTable("gender");
- entity.Property(e => e.IdGender).HasColumnName("id_gender");
- entity.Property(e => e.NameGender)
- .HasMaxLength(10)
- .HasColumnName("name_gender");
- });
- modelBuilder.Entity<Image>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("images_pkey");
- entity.ToTable("images");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Image1).HasColumnName("image");
- entity.Property(e => e.Users).HasColumnName("users");
- entity.HasOne(d => d.UsersNavigation).WithMany(p => p.Images)
- .HasForeignKey(d => d.Users)
- .HasConstraintName("images_users_fkey");
- });
- modelBuilder.Entity<Role>(entity =>
- {
- entity.HasKey(e => e.IdRole).HasName("roles_pkey");
- entity.ToTable("roles");
- entity.Property(e => e.IdRole)
- .ValueGeneratedNever()
- .HasColumnName("id_role");
- entity.Property(e => e.Names)
- .HasMaxLength(15)
- .HasColumnName("names");
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.UserId).HasName("users_pkey");
- entity.ToTable("users");
- entity.Property(e => e.UserId).HasColumnName("user_id");
- entity.Property(e => e.Genders).HasColumnName("genders");
- entity.Property(e => e.Login)
- .HasMaxLength(50)
- .HasColumnName("login");
- entity.Property(e => e.Name)
- .HasMaxLength(20)
- .HasColumnName("name");
- entity.Property(e => e.Password)
- .HasMaxLength(50)
- .HasColumnName("password");
- entity.Property(e => e.Roles).HasColumnName("roles");
- entity.Property(e => e.Surname)
- .HasMaxLength(20)
- .HasColumnName("surname");
- entity.HasOne(d => d.GendersNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.Genders)
- .HasConstraintName("users_genders_fkey");
- entity.HasOne(d => d.RolesNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.Roles)
- .HasConstraintName("users_roles_fkey");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|