12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaPractic.Models;
- public partial class Pavlov41pContext : DbContext
- {
- public Pavlov41pContext()
- {
- }
- public Pavlov41pContext(DbContextOptions<Pavlov41pContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Logined> Logineds { 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 https://go.microsoft.com/fwlink/?LinkId=723263.
- => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=pavlov41p;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Logined>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("logined_pkey");
- entity.ToTable("logined");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Login)
- .HasMaxLength(255)
- .HasColumnName("login");
- entity.Property(e => e.Password)
- .HasMaxLength(255)
- .HasColumnName("password");
- entity.Property(e => e.Roleid)
- .ValueGeneratedOnAdd()
- .HasColumnName("roleid");
- entity.Property(e => e.Userid)
- .ValueGeneratedOnAdd()
- .HasColumnName("userid");
- entity.HasOne(d => d.Role).WithMany(p => p.Logineds)
- .HasForeignKey(d => d.Roleid)
- .HasConstraintName("logined_roleid_fkey");
- entity.HasOne(d => d.User).WithMany(p => p.Logineds)
- .HasForeignKey(d => d.Userid)
- .HasConstraintName("logined_userid_fkey");
- });
- modelBuilder.Entity<Role>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("role_pkey");
- entity.ToTable("role");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Name)
- .HasMaxLength(50)
- .HasColumnName("name");
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("users_pkey");
- entity.ToTable("users");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Createdat)
- .HasDefaultValueSql("CURRENT_TIMESTAMP")
- .HasColumnType("timestamp without time zone")
- .HasColumnName("createdat");
- entity.Property(e => e.Email)
- .HasMaxLength(255)
- .HasColumnName("email");
- entity.Property(e => e.Username)
- .HasMaxLength(100)
- .HasColumnName("username");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|