|
@@ -0,0 +1,110 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
+
|
|
|
+namespace AvaloniaApplication5.Models;
|
|
|
+
|
|
|
+public partial class _1234Context : DbContext
|
|
|
+{
|
|
|
+ public _1234Context()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public _1234Context(DbContextOptions<_1234Context> options)
|
|
|
+ : base(options)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public virtual DbSet<Gender> Genders { get; set; }
|
|
|
+
|
|
|
+ public virtual DbSet<Logintable> Logintables { get; set; }
|
|
|
+
|
|
|
+ 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 http://go.microsoft.com/fwlink/?LinkId=723263.
|
|
|
+ => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=1234;Username=41P;Password=12357");
|
|
|
+
|
|
|
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
+ {
|
|
|
+ modelBuilder.Entity<Gender>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("genders_pk");
|
|
|
+
|
|
|
+ entity.ToTable("genders");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .HasColumnName("id");
|
|
|
+ entity.Property(e => e.Gender1)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("gender");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<Logintable>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("logintable_pk");
|
|
|
+
|
|
|
+ entity.ToTable("logintable");
|
|
|
+
|
|
|
+ entity.Property(e => e.Id)
|
|
|
+ .UseIdentityAlwaysColumn()
|
|
|
+ .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");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Logintables)
|
|
|
+ .HasForeignKey(d => d.IdRole)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("logintable_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ modelBuilder.Entity<Role>(entity =>
|
|
|
+ {
|
|
|
+ entity.HasKey(e => e.Id).HasName("roles_pk");
|
|
|
+
|
|
|
+ entity.ToTable("roles");
|
|
|
+
|
|
|
+ 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.IdLogin).HasName("users_pk");
|
|
|
+
|
|
|
+ entity.ToTable("users");
|
|
|
+
|
|
|
+ entity.Property(e => e.IdLogin)
|
|
|
+ .ValueGeneratedNever()
|
|
|
+ .HasColumnName("id_login");
|
|
|
+ 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.Name)
|
|
|
+ .HasColumnType("character varying")
|
|
|
+ .HasColumnName("name");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.Users)
|
|
|
+ .HasForeignKey(d => d.IdGender)
|
|
|
+ .OnDelete(DeleteBehavior.ClientSetNull)
|
|
|
+ .HasConstraintName("users_fk_1");
|
|
|
+
|
|
|
+ entity.HasOne(d => d.IdLoginNavigation).WithOne(p => p.User)
|
|
|
+ .HasForeignKey<User>(d => d.IdLogin)
|
|
|
+ .HasConstraintName("users_fk");
|
|
|
+ });
|
|
|
+
|
|
|
+ OnModelCreatingPartial(modelBuilder);
|
|
|
+ }
|
|
|
+
|
|
|
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
+}
|