using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace Users_Roles.Models; public partial class _43pGaruaev2Context : DbContext { public _43pGaruaev2Context() { } public _43pGaruaev2Context(DbContextOptions<_43pGaruaev2Context> options) : base(options) { } public virtual DbSet Roles { get; set; } public virtual DbSet 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 https://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=43P_Garuaev2;Username=43P;Password=444444"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.IdRole).HasName("roles_pkey"); entity.ToTable("roles"); entity.Property(e => e.IdRole).HasColumnName("id_role"); entity.Property(e => e.Title) .HasColumnType("character varying") .HasColumnName("title"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdUser).HasName("users_pkey"); entity.ToTable("users"); entity.Property(e => e.IdUser).HasColumnName("id_user"); entity.Property(e => e.Fio) .HasColumnType("character varying") .HasColumnName("fio"); entity.Property(e => e.Image).HasColumnName("image"); entity.Property(e => e.Login) .HasColumnType("character varying") .HasColumnName("login"); entity.Property(e => e.Pasword).HasColumnName("pasword"); entity.Property(e => e.RoleUser).HasColumnName("role_user"); entity.HasOne(d => d.RoleUserNavigation).WithMany(p => p.Users) .HasForeignKey(d => d.RoleUser) .HasConstraintName("users_role_user_fkey"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }