|
@@ -0,0 +1,108 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
+
|
|
|
+namespace AvaloniaApplicationPersonalPage.Models;
|
|
|
+
|
|
|
+public partial class UserBaseContext : DbContext
|
|
|
+{
|
|
|
+ public UserBaseContext()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public UserBaseContext(DbContextOptions<UserBaseContext> options)
|
|
|
+ : base(options)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public virtual DbSet<GenderTable> GenderTables { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<LoginTable> LoginTables { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<RoleTable> RoleTables { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<UserTable> UserTables { 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=UserBase;Username=43P;Password=444444");
|
|
|
+
|
|
|
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
+ {
|
|
|
+ modelBuilder.Entity<GenderTable>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.IdGender).HasName("gender_table_pk");
|
|
|
+
|
|
|
+ entity.ToTable("gender_table");
|
|
|
+
|
|
|
+ entity.Property(e => e.IdGender).HasColumnName("id_gender");
|
|
|
+ entity.Property(e => e.Gender)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("gender");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<LoginTable>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.IdLogin).HasName("login_table_pk");
|
|
|
+
|
|
|
+ entity.ToTable("login_table");
|
|
|
+
|
|
|
+ entity.Property(e => e.IdLogin).HasColumnName("id_login");
|
|
|
+ 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.LoginTables)
|
|
|
+ .HasForeignKey(d => d.IdRole)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("login_table_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<RoleTable>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.IdRole).HasName("role_table_pk");
|
|
|
+
|
|
|
+ entity.ToTable("role_table");
|
|
|
+
|
|
|
+ entity.Property(e => e.IdRole).HasColumnName("id_role");
|
|
|
+ entity.Property(e => e.Role)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("role");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<UserTable>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.IdUser).HasName("user_table_pk");
|
|
|
+
|
|
|
+ entity.ToTable("user_table");
|
|
|
+
|
|
|
+ entity.Property(e => e.IdUser)
|
|
|
+ .ValueGeneratedNever()
|
|
|
+ .HasColumnName("id_user");
|
|
|
+ entity.Property(e => e.Date)
|
|
|
+ .HasColumnType("timestamp without time zone")
|
|
|
+ .HasColumnName("date");
|
|
|
+ entity.Property(e => e.IdGender).HasColumnName("id_gender");
|
|
|
+ entity.Property(e => e.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.UserTables)
|
|
|
+ .HasForeignKey(d => d.IdGender)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("user_table_fk");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.UserTable)
|
|
|
+ .HasForeignKey<UserTable>(d => d.IdUser)
|
|
|
+ .HasConstraintName("user_table_fk_1");
|
|
|
+ });
|
|
|
+
|
|
|
+ OnModelCreatingPartial(modelBuilder);
|
|
|
+ }
|
|
|
+
|
|
|
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
+}
|