123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaHomeTry.Models;
- public partial class Bolshakov41pContext : DbContext
- {
- public Bolshakov41pContext()
- {
- }
- public Bolshakov41pContext(DbContextOptions<Bolshakov41pContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<RolesTable> RolesTables { get; set; }
- public virtual DbSet<Trait> Traits { get; set; }
- public virtual DbSet<UsersTable> UsersTable { 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=bolshakov41p;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Gender>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("genders_pkey");
- entity.ToTable("genders");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.GenderName)
- .HasMaxLength(7)
- .HasColumnName("genderName");
- });
- modelBuilder.Entity<RolesTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("roles_table_pkey");
- entity.ToTable("roles_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Role)
- .HasMaxLength(20)
- .HasColumnName("role");
- });
- modelBuilder.Entity<Trait>(entity =>
- {
- entity.HasKey(e => e.Idtraits).HasName("traits_pkey");
- entity.ToTable("traits");
- entity.Property(e => e.Idtraits).HasColumnName("idtraits");
- entity.Property(e => e.Titletraits).HasColumnName("titletraits");
- });
- modelBuilder.Entity<UsersTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("users_table_pkey");
- entity.ToTable("users_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Dataofbirth)
- .HasColumnType("timestamp without time zone")
- .HasColumnName("dataofbirth");
- entity.Property(e => e.Firstname)
- .HasMaxLength(30)
- .HasColumnName("firstname");
- entity.Property(e => e.IdGender).HasColumnName("genderid");
- entity.Property(e => e.Image).HasColumnName("image");
- entity.Property(e => e.Login)
- .HasMaxLength(30)
- .HasColumnName("login");
- entity.Property(e => e.Password)
- .HasMaxLength(30)
- .HasColumnName("password");
- entity.Property(e => e.Patronymic)
- .HasMaxLength(30)
- .HasColumnName("patronymic");
- entity.Property(e => e.IdRole).HasColumnName("roleid");
- entity.Property(e => e.Surname)
- .HasMaxLength(30)
- .HasColumnName("surname");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.UsersTables)
- .HasForeignKey(d => d.IdGender)
- .HasConstraintName("users_table_genderid_fkey");
- entity.HasOne(d => d.RoleNavigation).WithMany(p => p.UsersTables)
- .HasForeignKey(d => d.IdRole)
- .HasConstraintName("users_table_roleid_fkey");
- entity.HasMany(d => d.IdTraits).WithMany(p => p.Idusers)
- .UsingEntity<Dictionary<string, object>>(
- "Usersandtrait",
- r => r.HasOne<Trait>().WithMany()
- .HasForeignKey("Idtraits")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("usersandtraits_idtraits_fkey"),
- l => l.HasOne<UsersTable>().WithMany()
- .HasForeignKey("Iduser")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("usersandtraits_iduser_fkey"),
- j =>
- {
- j.HasKey("Iduser", "Idtraits").HasName("usersandtraits_pkey");
- j.ToTable("usersandtraits");
- j.IndexerProperty<int>("Iduser").HasColumnName("iduser");
- j.IndexerProperty<int>("Idtraits").HasColumnName("idtraits");
- });
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|