using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace AvaloniaApplicationTestNew.Models; public partial class _41pShmelevMvContext : DbContext { public _41pShmelevMvContext() { } public _41pShmelevMvContext(DbContextOptions<_41pShmelevMvContext> options) : base(options) { } public virtual DbSet Genders { get; set; } public virtual DbSet Logineds { get; set; } public virtual DbSet Roles { get; set; } public virtual DbSet Traits { 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=41P_ShmelevMV;Username=31P;Password=12345"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.IdGender).HasName("genders_pk"); entity.ToTable("genders"); entity.Property(e => e.IdGender).HasColumnName("id_gender"); entity.Property(e => e.Gender1) .HasColumnType("character varying") .HasColumnName("gender"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("logined_pk"); entity.ToTable("logined"); entity.HasIndex(e => e.IdRole, "IX_logined_id_role"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.IdRole).HasColumnName("id_role"); entity.Property(e => e.Login) .HasColumnType("character varying") .HasColumnName("login"); entity.Property(e => e.Password) .HasColumnType("character varying") .HasColumnName("password"); entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Logineds) .HasForeignKey(d => d.IdRole) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("logined_roles_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdRole).HasName("roles_pk"); entity.ToTable("roles"); entity.Property(e => e.IdRole).HasColumnName("id_role"); entity.Property(e => e.RoleName) .HasColumnType("character varying") .HasColumnName("role_name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Idtrait).HasName("trait_pk"); entity.ToTable("trait"); entity.Property(e => e.Idtrait).HasColumnName("idtrait"); entity.Property(e => e.Traitname) .HasColumnType("character varying") .HasColumnName("traitname"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdUser).HasName("users_pk"); entity.ToTable("users"); entity.HasIndex(e => e.IdGender, "IX_users_id_gender"); entity.Property(e => e.IdUser) .ValueGeneratedNever() .HasColumnName("id_user"); entity.Property(e => e.BirthDate) .HasColumnType("timestamp without time zone") .HasColumnName("birth_date"); entity.Property(e => e.IdGender).HasColumnName("id_gender"); entity.Property(e => e.Image).HasColumnName("image"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.Users) .HasForeignKey(d => d.IdGender) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("users_genders_fk"); entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.User) .HasForeignKey(d => d.IdUser) .HasConstraintName("users_logined_fk"); entity.HasMany(d => d.IdTraits).WithMany(p => p.IdUsers) .UsingEntity>( "UserTrait", r => r.HasOne().WithMany() .HasForeignKey("IdTrait") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("user_traits_trait_fk"), l => l.HasOne().WithMany() .HasForeignKey("IdUser") .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("user_traits_users_fk"), j => { j.HasKey("IdUser", "IdTrait").HasName("user_traits_pk"); j.ToTable("user_traits"); j.IndexerProperty("IdUser").HasColumnName("id_user"); j.IndexerProperty("IdTrait").HasColumnName("id_trait"); }); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }