|
@@ -0,0 +1,69 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
+
|
|
|
+namespace RegAuth.Models;
|
|
|
+
|
|
|
+public partial class _43pBezaeva2Context : DbContext
|
|
|
+{
|
|
|
+ public _43pBezaeva2Context()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public _43pBezaeva2Context(DbContextOptions<_43pBezaeva2Context> options)
|
|
|
+ : base(options)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public virtual DbSet<Role> Roles { 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=43P_Bezaeva2;Username=43P;Password=444444");
|
|
|
+
|
|
|
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
+ {
|
|
|
+ modelBuilder.Entity<Role>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("role_pk");
|
|
|
+
|
|
|
+ entity.ToTable("role");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id).HasColumnName("id");
|
|
|
+ entity.Property(e => e.Role1)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("role");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<User>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("users_pk");
|
|
|
+
|
|
|
+ entity.ToTable("users");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id).HasColumnName("id");
|
|
|
+ entity.Property(e => e.Fio)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("fio");
|
|
|
+ entity.Property(e => e.Img).HasColumnName("img");
|
|
|
+ entity.Property(e => e.Login)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("login");
|
|
|
+ entity.Property(e => e.Password).HasColumnName("password");
|
|
|
+ entity.Property(e => e.Roleid)
|
|
|
+ .ValueGeneratedOnAdd()
|
|
|
+ .HasColumnName("roleid");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.Role).WithMany(p => p.Users)
|
|
|
+ .HasForeignKey(d => d.Roleid)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("users_role_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ OnModelCreatingPartial(modelBuilder);
|
|
|
+ }
|
|
|
+
|
|
|
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
+}
|