using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace QualTask.Models; public partial class Gr692KnsContext : DbContext { public Gr692KnsContext() { } public Gr692KnsContext(DbContextOptions 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 http://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseNpgsql("Host=10.30.0.137;Port=5432;Database=gr692_kns;Username=gr692_kns;Password=pap04kA?"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("roles_pkey"); entity.ToTable("roles"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.RoleName) .HasMaxLength(50) .HasColumnName("role_name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("users_pkey"); entity.ToTable("users"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Fname) .HasMaxLength(100) .HasColumnName("fname"); entity.Property(e => e.Lname) .HasMaxLength(100) .HasColumnName("lname"); entity.Property(e => e.Login) .HasMaxLength(100) .HasColumnName("login"); entity.Property(e => e.Password) .HasMaxLength(100) .HasColumnName("password"); entity.Property(e => e.Role).HasColumnName("role"); entity.HasOne(d => d.RoleNavigation).WithMany(p => p.Users) .HasForeignKey(d => d.Role) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("users_role_fkey"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }