123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaApplication1.Models;
- public partial class Bobarik41pContext : DbContext
- {
- public Bobarik41pContext()
- {
- }
- public Bobarik41pContext(DbContextOptions<Bobarik41pContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Gender> Genders { get; set; }
- public virtual DbSet<Property> Properties { get; set; }
- public virtual DbSet<Role> Roles { get; set; }
- public virtual DbSet<Smeshariki> Smesharikis { 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=bobarik41p;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<Property>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("property_pkey");
- entity.ToTable("property");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Title)
- .HasMaxLength(50)
- .HasColumnName("title");
- });
- 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.Title)
- .HasMaxLength(50)
- .HasColumnName("title");
- });
- modelBuilder.Entity<Smeshariki>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("smeshariki_pkey");
- entity.ToTable("smeshariki");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Age).HasColumnName("age");
- entity.Property(e => e.Animal)
- .HasMaxLength(50)
- .HasColumnName("animal");
- entity.Property(e => e.Gender).HasColumnName("gender");
- entity.Property(e => e.Image).HasColumnName("image");
- entity.Property(e => e.Name)
- .HasMaxLength(50)
- .HasColumnName("name");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Smesharikis)
- .HasForeignKey(d => d.Gender)
- .HasConstraintName("smeshariki_gender_fkey");
- entity.HasMany(d => d.IdProperties).WithMany(p => p.IdSmeshes)
- .UsingEntity<Dictionary<string, object>>(
- "SmeshProperty",
- r => r.HasOne<Property>().WithMany()
- .HasForeignKey("IdProperty")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("smesh_property_id_property_fkey"),
- l => l.HasOne<Smeshariki>().WithMany()
- .HasForeignKey("IdSmesh")
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("smesh_property_id_smesh_fkey"),
- j =>
- {
- j.HasKey("IdSmesh", "IdProperty").HasName("smesh_property_pk");
- j.ToTable("smesh_property");
- j.IndexerProperty<int>("IdSmesh").HasColumnName("id_smesh");
- j.IndexerProperty<int>("IdProperty").HasColumnName("id_property");
- });
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("users_pkey");
- entity.ToTable("users");
- entity.HasIndex(e => e.Login, "users_login_key").IsUnique();
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.DateOfBirth)
- .HasColumnType("timestamp without time zone")
- .HasColumnName("date_of_birth");
- entity.Property(e => e.FirstName)
- .HasMaxLength(50)
- .HasColumnName("first_name");
- entity.Property(e => e.Gender).HasColumnName("gender");
- entity.Property(e => e.IdRole).HasColumnName("id_role");
- entity.Property(e => e.LastName)
- .HasMaxLength(50)
- .HasColumnName("last_name");
- entity.Property(e => e.Login)
- .HasMaxLength(50)
- .HasColumnName("login");
- entity.Property(e => e.Password)
- .HasMaxLength(50)
- .HasColumnName("password");
- entity.Property(e => e.Patronymic)
- .HasMaxLength(50)
- .HasColumnName("patronymic");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.Gender)
- .HasConstraintName("users_gender_fkey");
- entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Users)
- .HasForeignKey(d => d.IdRole)
- .HasConstraintName("fk_roles_users");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|