123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- 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<Gender> Genders { get; set; }
- public virtual DbSet<Logined> Logineds { get; set; }
- public virtual DbSet<Role> Roles { get; set; }
- public virtual DbSet<Trait> Traits { get; set; }
- public virtual DbSet<User> 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<Gender>(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<Logined>(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<Role>(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<Trait>(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<User>(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<User>(d => d.IdUser)
- .HasConstraintName("users_logined_fk");
- entity.HasMany(d => d.IdTraits).WithMany(p => p.IdUsers)
- .UsingEntity<Dictionary<string, object>>(
- "UserTrait",
- r => r.HasOne<Trait>().WithMany()
- .HasForeignKey("IdTrait")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("user_traits_trait_fk"),
- l => l.HasOne<User>().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<int>("IdUser").HasColumnName("id_user");
- j.IndexerProperty<int>("IdTrait").HasColumnName("id_trait");
- });
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|