123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaApplicationBase.Models;
- public partial class CatBaseContext : DbContext
- {
- public CatBaseContext()
- {
- }
- public CatBaseContext(DbContextOptions<CatBaseContext> options)
- : base(options)
- {
- }
- public virtual DbSet<CatTable> CatTables { get; set; }
- public virtual DbSet<GenderTable> GenderTables { get; set; }
- public virtual DbSet<TraitCatTable> TraitCatTables { get; set; }
- public virtual DbSet<TraitTable> TraitTables { 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=CatBase;Username=43P;Password=444444");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<CatTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("cat_table_pk");
- entity.ToTable("cat_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Date)
- .HasColumnType("timestamp without time zone")
- .HasColumnName("date");
- entity.Property(e => e.Gender).HasColumnName("gender");
- entity.Property(e => e.Name)
- .HasColumnType("character varying")
- .HasColumnName("name");
- entity.HasOne(d => d.GenderNavigation).WithMany(p => p.CatTables)
- .HasForeignKey(d => d.Gender)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("cat_table_fk");
- });
- modelBuilder.Entity<GenderTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("gender_table_pk");
- entity.ToTable("gender_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Gender)
- .HasColumnType("character varying")
- .HasColumnName("gender");
- });
- modelBuilder.Entity<TraitCatTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("trait_cat_table_pk");
- entity.ToTable("trait_cat_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.IdCat).HasColumnName("id_cat");
- entity.Property(e => e.IdTrait).HasColumnName("id_trait");
- entity.HasOne(d => d.IdCatNavigation).WithMany(p => p.TraitCatTables)
- .HasForeignKey(d => d.IdCat)
- .HasConstraintName("trait_cat_table_fk");
- entity.HasOne(d => d.IdTraitNavigation).WithMany(p => p.TraitCatTables)
- .HasForeignKey(d => d.IdTrait)
- .HasConstraintName("trait_cat_table_fk_1");
- });
- modelBuilder.Entity<TraitTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("trait_table_pk");
- entity.ToTable("trait_table");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Trait)
- .HasColumnType("character varying")
- .HasColumnName("trait");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|