using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace TestApplication.Context; public partial class TyutyunnikovaContext : DbContext { public TyutyunnikovaContext() { } public TyutyunnikovaContext(DbContextOptions options) : base(options) { } public virtual DbSet Clients { get; set; } public virtual DbSet Clients1 { get; set; } public virtual DbSet ClientServices1 { get; set; } public virtual DbSet Clientservices { get; set; } public virtual DbSet DocumentByServices { get; set; } public virtual DbSet Documentbyservices1 { get; set; } public virtual DbSet Genders { get; set; } public virtual DbSet Genders1 { get; set; } public virtual DbSet Manufacturers { get; set; } public virtual DbSet Manufacturers1 { get; set; } public virtual DbSet Products { get; set; } public virtual DbSet Products1 { get; set; } public virtual DbSet ProductPhotos1 { get; set; } public virtual DbSet ProductSales1 { get; set; } public virtual DbSet Productphotos { get; set; } public virtual DbSet Productsales { get; set; } public virtual DbSet Services { get; set; } public virtual DbSet Services1 { get; set; } public virtual DbSet ServicePhotos { get; set; } public virtual DbSet Servicephotos1 { get; set; } public virtual DbSet Tags { get; set; } public virtual DbSet Tags1 { 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=45.67.56.214;Port=5454;Database=tyutyunnikova;Username=tyutyunnikova;password=weGk7YzI"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("client_pkey"); entity.ToTable("client"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Birthday) .HasColumnType("character varying") .HasColumnName("birthday"); entity.Property(e => e.Email) .HasMaxLength(255) .HasColumnName("email"); entity.Property(e => e.Firstname) .HasMaxLength(50) .HasColumnName("firstname"); entity.Property(e => e.Gendercode) .HasMaxLength(1) .HasColumnName("gendercode"); entity.Property(e => e.Lastname) .HasMaxLength(50) .HasColumnName("lastname"); entity.Property(e => e.Patronymic) .HasMaxLength(50) .HasColumnName("patronymic"); entity.Property(e => e.Phone) .HasMaxLength(20) .HasColumnName("phone"); entity.Property(e => e.Photopath) .HasMaxLength(1000) .HasColumnName("photopath"); entity.Property(e => e.Registrationdate) .HasColumnType("character varying") .HasColumnName("registrationdate"); entity.HasOne(d => d.GendercodeNavigation).WithMany(p => p.Clients) .HasForeignKey(d => d.Gendercode) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("client_gendercode_fkey"); entity.HasMany(d => d.Tags).WithMany(p => p.Clients) .UsingEntity>( "Tagofclient", r => r.HasOne().WithMany() .HasForeignKey("Tagid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tagofclient_tagid_fkey"), l => l.HasOne().WithMany() .HasForeignKey("Clientid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("tagofclient_clientid_fkey"), j => { j.HasKey("Clientid", "Tagid").HasName("tagofclient_pk"); j.ToTable("tagofclient"); j.IndexerProperty("Clientid").HasColumnName("clientid"); j.IndexerProperty("Tagid").HasColumnName("tagid"); }); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("Client_pkey"); entity.ToTable("Client", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.Email).HasMaxLength(255); entity.Property(e => e.FirstName).HasMaxLength(50); entity.Property(e => e.GenderCode).HasMaxLength(1); entity.Property(e => e.LastName).HasMaxLength(50); entity.Property(e => e.Patronymic).HasMaxLength(50); entity.Property(e => e.Phone).HasMaxLength(20); entity.Property(e => e.PhotoPath).HasMaxLength(1000); entity.HasOne(d => d.GenderCodeNavigation).WithMany(p => p.Client1s) .HasForeignKey(d => d.GenderCode) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Client_Gender"); entity.HasMany(d => d.Tags).WithMany(p => p.Clients) .UsingEntity>( "TagOfClient1", r => r.HasOne().WithMany() .HasForeignKey("TagId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_TagOfClient_Tag"), l => l.HasOne().WithMany() .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_TagOfClient_Client"), j => { j.HasKey("ClientId", "TagId").HasName("TagOfClient_pkey"); j.ToTable("TagOfClient", "Clients"); j.IndexerProperty("ClientId").HasColumnName("ClientID"); j.IndexerProperty("TagId").HasColumnName("TagID"); }); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("ClientService_pkey"); entity.ToTable("ClientService", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.ClientId).HasColumnName("ClientID"); entity.Property(e => e.ServiceId).HasColumnName("ServiceID"); entity.HasOne(d => d.Client).WithMany(p => p.ClientService1s) .HasForeignKey(d => d.ClientId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ClientService_Client"); entity.HasOne(d => d.Service).WithMany(p => p.ClientService1s) .HasForeignKey(d => d.ServiceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ClientService_Service"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("clientservice_pkey"); entity.ToTable("clientservice"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Clientid).HasColumnName("clientid"); entity.Property(e => e.Comment).HasColumnName("comment"); entity.Property(e => e.Serviceid).HasColumnName("serviceid"); entity.Property(e => e.Starttime) .HasColumnType("timestamp without time zone") .HasColumnName("starttime"); entity.HasOne(d => d.Client).WithMany(p => p.Clientservices) .HasForeignKey(d => d.Clientid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("clientservice_clientid_fkey"); entity.HasOne(d => d.Service).WithMany(p => p.Clientservices) .HasForeignKey(d => d.Serviceid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("clientservice_serviceid_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("DocumentByService_pkey"); entity.ToTable("DocumentByService", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.ClientServiceId).HasColumnName("ClientServiceID"); entity.Property(e => e.DocumentPath).HasMaxLength(1000); entity.HasOne(d => d.ClientService).WithMany(p => p.DocumentByServices) .HasForeignKey(d => d.ClientServiceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_DocumentByService_ClientService"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("documentbyservice_pkey"); entity.ToTable("documentbyservice"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid"); entity.Property(e => e.Documentpath) .HasMaxLength(1000) .HasColumnName("documentpath"); entity.HasOne(d => d.Clientservice).WithMany(p => p.Documentbyservice1s) .HasForeignKey(d => d.Clientserviceid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("documentbyservice_clientserviceid_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Code).HasName("Gender_pkey"); entity.ToTable("Gender", "Clients"); entity.Property(e => e.Code) .HasMaxLength(1) .ValueGeneratedNever(); entity.Property(e => e.Name).HasMaxLength(10); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Code).HasName("gender_pkey"); entity.ToTable("gender"); entity.Property(e => e.Code) .HasMaxLength(1) .ValueGeneratedNever() .HasColumnName("code"); entity.Property(e => e.Name) .HasMaxLength(10) .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("manufacturer_pkey"); entity.ToTable("manufacturer"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .HasMaxLength(100) .HasColumnName("name"); entity.Property(e => e.Startdate).HasColumnName("startdate"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("Manufacturer_pkey"); entity.ToTable("Manufacturer", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.Name).HasMaxLength(100); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("product_pkey"); entity.ToTable("product"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Cost) .HasPrecision(19, 4) .HasColumnName("cost"); entity.Property(e => e.Description).HasColumnName("description"); entity.Property(e => e.Isactive).HasColumnName("isactive"); entity.Property(e => e.Mainimagepath) .HasMaxLength(1000) .HasColumnName("mainimagepath"); entity.Property(e => e.Manufacturerid).HasColumnName("manufacturerid"); entity.Property(e => e.Title) .HasMaxLength(100) .HasColumnName("title"); entity.HasOne(d => d.Manufacturer).WithMany(p => p.Products) .HasForeignKey(d => d.Manufacturerid) .HasConstraintName("product_manufacturerid_fkey"); entity.HasMany(d => d.Attachedproducts).WithMany(p => p.Mainproducts) .UsingEntity>( "Attachedproduct1", r => r.HasOne().WithMany() .HasForeignKey("Attachedproductid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("attachedproduct_attachedproductid_fkey"), l => l.HasOne().WithMany() .HasForeignKey("Mainproductid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("attachedproduct_mainproductid_fkey"), j => { j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pk"); j.ToTable("attachedproduct"); j.IndexerProperty("Mainproductid").HasColumnName("mainproductid"); j.IndexerProperty("Attachedproductid").HasColumnName("attachedproductid"); }); entity.HasMany(d => d.Mainproducts).WithMany(p => p.Attachedproducts) .UsingEntity>( "Attachedproduct1", r => r.HasOne().WithMany() .HasForeignKey("Mainproductid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("attachedproduct_mainproductid_fkey"), l => l.HasOne().WithMany() .HasForeignKey("Attachedproductid") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("attachedproduct_attachedproductid_fkey"), j => { j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pk"); j.ToTable("attachedproduct"); j.IndexerProperty("Mainproductid").HasColumnName("mainproductid"); j.IndexerProperty("Attachedproductid").HasColumnName("attachedproductid"); }); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("Product_pkey"); entity.ToTable("Product", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.Cost).HasPrecision(19, 4); entity.Property(e => e.MainImagePath).HasMaxLength(1000); entity.Property(e => e.ManufacturerId).HasColumnName("ManufacturerID"); entity.Property(e => e.Title).HasMaxLength(100); entity.HasOne(d => d.Manufacturer).WithMany(p => p.Product1s) .HasForeignKey(d => d.ManufacturerId) .HasConstraintName("FK_Product_Manufacturer"); entity.HasMany(d => d.AttachedProducts).WithMany(p => p.MainProducts) .UsingEntity>( "AttachedProduct", r => r.HasOne().WithMany() .HasForeignKey("AttachedProductId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_AttachedProduct_Product1"), l => l.HasOne().WithMany() .HasForeignKey("MainProductId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_AttachedProduct_Product"), j => { j.HasKey("MainProductId", "AttachedProductId").HasName("AttachedProduct_pkey"); j.ToTable("AttachedProduct", "Clients"); j.IndexerProperty("MainProductId").HasColumnName("MainProductID"); j.IndexerProperty("AttachedProductId").HasColumnName("AttachedProductID"); }); entity.HasMany(d => d.MainProducts).WithMany(p => p.AttachedProducts) .UsingEntity>( "AttachedProduct", r => r.HasOne().WithMany() .HasForeignKey("MainProductId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_AttachedProduct_Product"), l => l.HasOne().WithMany() .HasForeignKey("AttachedProductId") .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_AttachedProduct_Product1"), j => { j.HasKey("MainProductId", "AttachedProductId").HasName("AttachedProduct_pkey"); j.ToTable("AttachedProduct", "Clients"); j.IndexerProperty("MainProductId").HasColumnName("MainProductID"); j.IndexerProperty("AttachedProductId").HasColumnName("AttachedProductID"); }); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("ProductPhoto_pkey"); entity.ToTable("ProductPhoto", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.PhotoPath).HasMaxLength(1000); entity.Property(e => e.ProductId).HasColumnName("ProductID"); entity.HasOne(d => d.Product).WithMany(p => p.ProductPhoto1s) .HasForeignKey(d => d.ProductId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ProductPhoto_Product"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("ProductSale_pkey"); entity.ToTable("ProductSale", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.ClientServiceId).HasColumnName("ClientServiceID"); entity.Property(e => e.ProductId).HasColumnName("ProductID"); entity.HasOne(d => d.ClientService).WithMany(p => p.ProductSale1s) .HasForeignKey(d => d.ClientServiceId) .HasConstraintName("FK_ProductSale_ClientService"); entity.HasOne(d => d.Product).WithMany(p => p.ProductSale1s) .HasForeignKey(d => d.ProductId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ProductSale_Product"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("productphoto_pkey"); entity.ToTable("productphoto"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Photopath) .HasMaxLength(1000) .HasColumnName("photopath"); entity.Property(e => e.Productid).HasColumnName("productid"); entity.HasOne(d => d.Product).WithMany(p => p.Productphotos) .HasForeignKey(d => d.Productid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("productphoto_productid_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("productsale_pkey"); entity.ToTable("productsale"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid"); entity.Property(e => e.Productid).HasColumnName("productid"); entity.Property(e => e.Quantity).HasColumnName("quantity"); entity.Property(e => e.Saledate) .HasColumnType("character varying") .HasColumnName("saledate"); entity.HasOne(d => d.Clientservice).WithMany(p => p.Productsales) .HasForeignKey(d => d.Clientserviceid) .HasConstraintName("productsale_clientserviceid_fkey"); entity.HasOne(d => d.Product).WithMany(p => p.Productsales) .HasForeignKey(d => d.Productid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("productsale_productid_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("Service_pkey"); entity.ToTable("Service", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.Cost).HasPrecision(19, 4); entity.Property(e => e.MainImagePath).HasMaxLength(1000); entity.Property(e => e.Title).HasMaxLength(100); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("service_pkey"); entity.ToTable("service"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Cost) .HasPrecision(19, 4) .HasColumnName("cost"); entity.Property(e => e.Description).HasColumnName("description"); entity.Property(e => e.Discount).HasColumnName("discount"); entity.Property(e => e.Durationinseconds).HasColumnName("durationinseconds"); entity.Property(e => e.Mainimagepath) .HasMaxLength(1000) .HasColumnName("mainimagepath"); entity.Property(e => e.Title) .HasMaxLength(100) .HasColumnName("title"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("ServicePhoto_pkey"); entity.ToTable("ServicePhoto", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.PhotoPath).HasMaxLength(1000); entity.Property(e => e.ServiceId).HasColumnName("ServiceID"); entity.HasOne(d => d.Service).WithMany(p => p.ServicePhotos) .HasForeignKey(d => d.ServiceId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ServicePhoto_Service"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("servicephoto_pkey"); entity.ToTable("servicephoto"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Photopath) .HasMaxLength(1000) .HasColumnName("photopath"); entity.Property(e => e.Serviceid).HasColumnName("serviceid"); entity.HasOne(d => d.Service).WithMany(p => p.Servicephoto1s) .HasForeignKey(d => d.Serviceid) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("servicephoto_serviceid_fkey"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("Tag_pkey"); entity.ToTable("Tag", "Clients"); entity.Property(e => e.Id).HasColumnName("ID"); entity.Property(e => e.Color) .HasMaxLength(6) .IsFixedLength(); entity.Property(e => e.Title).HasMaxLength(30); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("tag_pkey"); entity.ToTable("tag"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Color) .HasMaxLength(6) .IsFixedLength() .HasColumnName("color"); entity.Property(e => e.Title) .HasMaxLength(30) .HasColumnName("title"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }