using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace exam.Models; public partial class PostgresContext : DbContext { public PostgresContext() { } public PostgresContext(DbContextOptions options) : base(options) { } public virtual DbSet Countries { 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=localhost;Port=5432;Database=postgres;Username=postgres;Password=plo030803a"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasPostgresExtension("pg_catalog", "adminpack"); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("countries_pkey"); entity.ToTable("countries"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Country1) .HasMaxLength(100) .HasColumnName("country"); }); 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.Firstname) .HasMaxLength(100) .HasColumnName("firstname"); entity.Property(e => e.Idcountry).HasColumnName("idcountry"); entity.Property(e => e.Lastname) .HasMaxLength(100) .HasColumnName("lastname"); entity.Property(e => e.Loginuser) .HasMaxLength(100) .HasColumnName("loginuser"); entity.Property(e => e.Passworsuser) .HasMaxLength(100) .HasColumnName("passworsuser"); entity.HasOne(d => d.IdcountryNavigation).WithMany(p => p.Users) .HasForeignKey(d => d.Idcountry) .HasConstraintName("users_idcountry_fkey"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }