KuzmintestprojContext.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.EntityFrameworkCore;
  4. namespace kuzminIVProjectWorkOnDemo.Models;
  5. public partial class KuzmintestprojContext : DbContext
  6. {
  7. public KuzmintestprojContext()
  8. {
  9. }
  10. public KuzmintestprojContext(DbContextOptions<KuzmintestprojContext> options)
  11. : base(options)
  12. {
  13. }
  14. public virtual DbSet<Sevice> Sevices { get; set; }
  15. public virtual DbSet<Sevicesandclient> Sevicesandclients { get; set; }
  16. public virtual DbSet<User> Users { get; set; }
  17. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  18. #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.
  19. => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=kuzmintestproj;Username=31P;Password=12345");
  20. protected override void OnModelCreating(ModelBuilder modelBuilder)
  21. {
  22. modelBuilder.Entity<Sevice>(entity =>
  23. {
  24. entity.HasKey(e => e.Id).HasName("sevices_pkey");
  25. entity.ToTable("sevices");
  26. entity.Property(e => e.Id).HasColumnName("id");
  27. entity.Property(e => e.Cost).HasColumnName("cost");
  28. entity.Property(e => e.Discount).HasColumnName("discount");
  29. entity.Property(e => e.Duration).HasColumnName("duration");
  30. entity.Property(e => e.Image)
  31. .HasMaxLength(100)
  32. .IsFixedLength()
  33. .HasColumnName("image");
  34. entity.Property(e => e.Title)
  35. .HasMaxLength(200)
  36. .IsFixedLength()
  37. .HasColumnName("title");
  38. });
  39. modelBuilder.Entity<Sevicesandclient>(entity =>
  40. {
  41. entity.HasKey(e => e.Id).HasName("sevicesandclient_pkey");
  42. entity.ToTable("sevicesandclient");
  43. entity.Property(e => e.Id).HasColumnName("id");
  44. entity.Property(e => e.Dateoflesson)
  45. .HasColumnType("timestamp without time zone")
  46. .HasColumnName("dateoflesson");
  47. entity.Property(e => e.Idtitle).HasColumnName("idtitle");
  48. entity.Property(e => e.Iduser).HasColumnName("iduser");
  49. entity.HasOne(d => d.IdtitleNavigation).WithMany(p => p.Sevicesandclients)
  50. .HasForeignKey(d => d.Idtitle)
  51. .HasConstraintName("sevicesandclient_idtitle_fkey");
  52. entity.HasOne(d => d.IduserNavigation).WithMany(p => p.Sevicesandclients)
  53. .HasForeignKey(d => d.Iduser)
  54. .HasConstraintName("sevicesandclient_iduser_fkey");
  55. });
  56. modelBuilder.Entity<User>(entity =>
  57. {
  58. entity.HasKey(e => e.Id).HasName("users_pkey");
  59. entity.ToTable("users");
  60. entity.Property(e => e.Id).HasColumnName("id");
  61. entity.Property(e => e.Dob)
  62. .HasColumnType("timestamp without time zone")
  63. .HasColumnName("dob");
  64. entity.Property(e => e.Dor)
  65. .HasColumnType("timestamp without time zone")
  66. .HasColumnName("dor");
  67. entity.Property(e => e.Email)
  68. .HasMaxLength(40)
  69. .IsFixedLength()
  70. .HasColumnName("email");
  71. entity.Property(e => e.Fname)
  72. .HasMaxLength(30)
  73. .IsFixedLength()
  74. .HasColumnName("fname");
  75. entity.Property(e => e.Gender)
  76. .HasMaxLength(1)
  77. .HasColumnName("gender");
  78. entity.Property(e => e.Mname)
  79. .HasMaxLength(30)
  80. .IsFixedLength()
  81. .HasColumnName("mname");
  82. entity.Property(e => e.Sname)
  83. .HasMaxLength(30)
  84. .IsFixedLength()
  85. .HasColumnName("sname");
  86. entity.Property(e => e.Telnum)
  87. .HasMaxLength(50)
  88. .IsFixedLength()
  89. .HasColumnName("telnum");
  90. });
  91. OnModelCreatingPartial(modelBuilder);
  92. }
  93. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  94. }