123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace WebApplicationAvaloniaForMe.Models;
- public partial class KuzminivpostgrContext : DbContext
- {
- public KuzminivpostgrContext()
- {
- }
- public KuzminivpostgrContext(DbContextOptions<KuzminivpostgrContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<Mycharacter> Mycharacters { get; set; }
- public virtual DbSet<Property> Properties { 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=kuzminivpostgr;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Gender>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("gender_pkey");
- entity.ToTable("gender");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Title)
- .HasMaxLength(7)
- .HasColumnName("title");
- });
- modelBuilder.Entity<Mycharacter>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("mycharacters_pkey");
- entity.ToTable("mycharacters");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Dob)
- .HasColumnType("timestamp without time zone")
- .HasColumnName("dob");
- entity.Property(e => e.Gender).HasColumnName("gender");
- entity.Property(e => e.Imageprof).HasColumnName("imageprof");
- entity.Property(e => e.Sname)
- .HasMaxLength(30)
- .HasColumnName("sname");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Mycharacters)
- .HasForeignKey(d => d.Gender)
- .HasConstraintName("mycharacters_gender_fkey");
- });
- modelBuilder.Entity<Property>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("property_pkey");
- entity.ToTable("property");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Propertyname)
- .HasMaxLength(30)
- .HasColumnName("propertyname");
- entity.HasMany(d => d.Mycharacters).WithMany(p => p.Properties)
- .UsingEntity<Dictionary<string, object>>(
- "Charactersproperty",
- r => r.HasOne<Mycharacter>().WithMany()
- .HasForeignKey("Mycharacterid")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("charactersproperty_mycharacterid_fkey"),
- l => l.HasOne<Property>().WithMany()
- .HasForeignKey("Propertyid")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("charactersproperty_propertyid_fkey"),
- j =>
- {
- j.HasKey("Propertyid", "Mycharacterid").HasName("charactersproperty_pkey");
- j.ToTable("charactersproperty");
- j.IndexerProperty<int>("Propertyid").HasColumnName("propertyid");
- j.IndexerProperty<int>("Mycharacterid").HasColumnName("mycharacterid");
- });
- });
- modelBuilder.Entity<Role>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("roles_pkey");
- entity.ToTable("roles");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Rolename)
- .HasMaxLength(30)
- .HasColumnName("rolename");
- });
- 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.Dob)
- .HasColumnType("timestamp without time zone")
- .HasColumnName("dob");
- entity.Property(e => e.Fname)
- .HasMaxLength(30)
- .HasColumnName("fname");
- entity.Property(e => e.Gender).HasColumnName("gender");
- entity.Property(e => e.Idroles).HasColumnName("idroles");
- entity.Property(e => e.Lname)
- .HasMaxLength(30)
- .HasColumnName("lname");
- entity.Property(e => e.Login)
- .HasMaxLength(30)
- .HasColumnName("login");
- entity.Property(e => e.Passwords)
- .HasMaxLength(30)
- .HasColumnName("passwords");
- entity.Property(e => e.Sname)
- .HasMaxLength(30)
- .HasColumnName("sname");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.Gender)
- .HasConstraintName("users_gender_fkey");
- entity.HasOne(d => d.IdrolesNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.Idroles)
- .HasConstraintName("users_idroles_fkey");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|