compose_sample/TestApplication/Context/TyutyunnikovaContext.cs

595 lines
25 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace TestApplication.Context;
public partial class TyutyunnikovaContext : DbContext
{
public TyutyunnikovaContext()
{
}
public TyutyunnikovaContext(DbContextOptions<TyutyunnikovaContext> options)
: base(options)
{
}
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Client1> Clients1 { get; set; }
public virtual DbSet<ClientService1> ClientServices1 { get; set; }
public virtual DbSet<Clientservice> Clientservices { get; set; }
public virtual DbSet<DocumentByService> DocumentByServices { get; set; }
public virtual DbSet<Documentbyservice1> Documentbyservices1 { get; set; }
public virtual DbSet<Gender> Genders { get; set; }
public virtual DbSet<Gender1> Genders1 { get; set; }
public virtual DbSet<Manufacturer> Manufacturers { get; set; }
public virtual DbSet<Manufacturer1> Manufacturers1 { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<Product1> Products1 { get; set; }
public virtual DbSet<ProductPhoto1> ProductPhotos1 { get; set; }
public virtual DbSet<ProductSale1> ProductSales1 { get; set; }
public virtual DbSet<Productphoto> Productphotos { get; set; }
public virtual DbSet<Productsale> Productsales { get; set; }
public virtual DbSet<Service> Services { get; set; }
public virtual DbSet<Service1> Services1 { get; set; }
public virtual DbSet<ServicePhoto> ServicePhotos { get; set; }
public virtual DbSet<Servicephoto1> Servicephotos1 { get; set; }
public virtual DbSet<Tag> Tags { get; set; }
public virtual DbSet<Tag1> 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<Client>(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<Dictionary<string, object>>(
"Tagofclient",
r => r.HasOne<Tag1>().WithMany()
.HasForeignKey("Tagid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("tagofclient_tagid_fkey"),
l => l.HasOne<Client>().WithMany()
.HasForeignKey("Clientid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("tagofclient_clientid_fkey"),
j =>
{
j.HasKey("Clientid", "Tagid").HasName("tagofclient_pk");
j.ToTable("tagofclient");
j.IndexerProperty<int>("Clientid").HasColumnName("clientid");
j.IndexerProperty<int>("Tagid").HasColumnName("tagid");
});
});
modelBuilder.Entity<Client1>(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<Dictionary<string, object>>(
"TagOfClient1",
r => r.HasOne<Tag>().WithMany()
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TagOfClient_Tag"),
l => l.HasOne<Client1>().WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_TagOfClient_Client"),
j =>
{
j.HasKey("ClientId", "TagId").HasName("TagOfClient_pkey");
j.ToTable("TagOfClient", "Clients");
j.IndexerProperty<int>("ClientId").HasColumnName("ClientID");
j.IndexerProperty<int>("TagId").HasColumnName("TagID");
});
});
modelBuilder.Entity<ClientService1>(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<Clientservice>(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<DocumentByService>(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<Documentbyservice1>(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<Gender>(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<Gender1>(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<Manufacturer>(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<Manufacturer1>(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<Product>(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<Dictionary<string, object>>(
"Attachedproduct1",
r => r.HasOne<Product>().WithMany()
.HasForeignKey("Attachedproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("attachedproduct_attachedproductid_fkey"),
l => l.HasOne<Product>().WithMany()
.HasForeignKey("Mainproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("attachedproduct_mainproductid_fkey"),
j =>
{
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pk");
j.ToTable("attachedproduct");
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
});
entity.HasMany(d => d.Mainproducts).WithMany(p => p.Attachedproducts)
.UsingEntity<Dictionary<string, object>>(
"Attachedproduct1",
r => r.HasOne<Product>().WithMany()
.HasForeignKey("Mainproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("attachedproduct_mainproductid_fkey"),
l => l.HasOne<Product>().WithMany()
.HasForeignKey("Attachedproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("attachedproduct_attachedproductid_fkey"),
j =>
{
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pk");
j.ToTable("attachedproduct");
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
});
});
modelBuilder.Entity<Product1>(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<Dictionary<string, object>>(
"AttachedProduct",
r => r.HasOne<Product1>().WithMany()
.HasForeignKey("AttachedProductId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_AttachedProduct_Product1"),
l => l.HasOne<Product1>().WithMany()
.HasForeignKey("MainProductId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_AttachedProduct_Product"),
j =>
{
j.HasKey("MainProductId", "AttachedProductId").HasName("AttachedProduct_pkey");
j.ToTable("AttachedProduct", "Clients");
j.IndexerProperty<int>("MainProductId").HasColumnName("MainProductID");
j.IndexerProperty<int>("AttachedProductId").HasColumnName("AttachedProductID");
});
entity.HasMany(d => d.MainProducts).WithMany(p => p.AttachedProducts)
.UsingEntity<Dictionary<string, object>>(
"AttachedProduct",
r => r.HasOne<Product1>().WithMany()
.HasForeignKey("MainProductId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_AttachedProduct_Product"),
l => l.HasOne<Product1>().WithMany()
.HasForeignKey("AttachedProductId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_AttachedProduct_Product1"),
j =>
{
j.HasKey("MainProductId", "AttachedProductId").HasName("AttachedProduct_pkey");
j.ToTable("AttachedProduct", "Clients");
j.IndexerProperty<int>("MainProductId").HasColumnName("MainProductID");
j.IndexerProperty<int>("AttachedProductId").HasColumnName("AttachedProductID");
});
});
modelBuilder.Entity<ProductPhoto1>(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<ProductSale1>(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<Productphoto>(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<Productsale>(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<Service>(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<Service1>(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<ServicePhoto>(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<Servicephoto1>(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<Tag>(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<Tag1>(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);
}