KuzminivpostgrContext.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.EntityFrameworkCore;
  4. namespace WebApplicationAvaloniaForMe.Models;
  5. public partial class KuzminivpostgrContext : DbContext
  6. {
  7. public KuzminivpostgrContext()
  8. {
  9. }
  10. public KuzminivpostgrContext(DbContextOptions<KuzminivpostgrContext> options)
  11. : base(options)
  12. {
  13. }
  14. public virtual DbSet<Gender> Genders { get; set; }
  15. public virtual DbSet<Mycharacter> Mycharacters { get; set; }
  16. public virtual DbSet<Property> Properties { get; set; }
  17. public virtual DbSet<Role> Roles { get; set; }
  18. public virtual DbSet<User> Users { get; set; }
  19. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  20. #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.
  21. => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=kuzminivpostgr;Username=31P;Password=12345");
  22. protected override void OnModelCreating(ModelBuilder modelBuilder)
  23. {
  24. modelBuilder.Entity<Gender>(entity =>
  25. {
  26. entity.HasKey(e => e.Id).HasName("gender_pkey");
  27. entity.ToTable("gender");
  28. entity.Property(e => e.Id).HasColumnName("id");
  29. entity.Property(e => e.Title)
  30. .HasMaxLength(7)
  31. .HasColumnName("title");
  32. });
  33. modelBuilder.Entity<Mycharacter>(entity =>
  34. {
  35. entity.HasKey(e => e.Id).HasName("mycharacters_pkey");
  36. entity.ToTable("mycharacters");
  37. entity.Property(e => e.Id).HasColumnName("id");
  38. entity.Property(e => e.Dob)
  39. .HasColumnType("timestamp without time zone")
  40. .HasColumnName("dob");
  41. entity.Property(e => e.Gender).HasColumnName("gender");
  42. entity.Property(e => e.Imageprof).HasColumnName("imageprof");
  43. entity.Property(e => e.Sname)
  44. .HasMaxLength(30)
  45. .HasColumnName("sname");
  46. entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Mycharacters)
  47. .HasForeignKey(d => d.Gender)
  48. .HasConstraintName("mycharacters_gender_fkey");
  49. });
  50. modelBuilder.Entity<Property>(entity =>
  51. {
  52. entity.HasKey(e => e.Id).HasName("property_pkey");
  53. entity.ToTable("property");
  54. entity.Property(e => e.Id).HasColumnName("id");
  55. entity.Property(e => e.Propertyname)
  56. .HasMaxLength(30)
  57. .HasColumnName("propertyname");
  58. entity.HasMany(d => d.Mycharacters).WithMany(p => p.Properties)
  59. .UsingEntity<Dictionary<string, object>>(
  60. "Charactersproperty",
  61. r => r.HasOne<Mycharacter>().WithMany()
  62. .HasForeignKey("Mycharacterid")
  63. .OnDelete(DeleteBehavior.ClientSetNull)
  64. .HasConstraintName("charactersproperty_mycharacterid_fkey"),
  65. l => l.HasOne<Property>().WithMany()
  66. .HasForeignKey("Propertyid")
  67. .OnDelete(DeleteBehavior.ClientSetNull)
  68. .HasConstraintName("charactersproperty_propertyid_fkey"),
  69. j =>
  70. {
  71. j.HasKey("Propertyid", "Mycharacterid").HasName("charactersproperty_pkey");
  72. j.ToTable("charactersproperty");
  73. j.IndexerProperty<int>("Propertyid").HasColumnName("propertyid");
  74. j.IndexerProperty<int>("Mycharacterid").HasColumnName("mycharacterid");
  75. });
  76. });
  77. modelBuilder.Entity<Role>(entity =>
  78. {
  79. entity.HasKey(e => e.Id).HasName("roles_pkey");
  80. entity.ToTable("roles");
  81. entity.Property(e => e.Id).HasColumnName("id");
  82. entity.Property(e => e.Rolename)
  83. .HasMaxLength(30)
  84. .HasColumnName("rolename");
  85. });
  86. modelBuilder.Entity<User>(entity =>
  87. {
  88. entity.HasKey(e => e.Id).HasName("users_pkey");
  89. entity.ToTable("users");
  90. entity.Property(e => e.Id).HasColumnName("id");
  91. entity.Property(e => e.Dob)
  92. .HasColumnType("timestamp without time zone")
  93. .HasColumnName("dob");
  94. entity.Property(e => e.Fname)
  95. .HasMaxLength(30)
  96. .HasColumnName("fname");
  97. entity.Property(e => e.Gender).HasColumnName("gender");
  98. entity.Property(e => e.Idroles).HasColumnName("idroles");
  99. entity.Property(e => e.Lname)
  100. .HasMaxLength(30)
  101. .HasColumnName("lname");
  102. entity.Property(e => e.Login)
  103. .HasMaxLength(30)
  104. .HasColumnName("login");
  105. entity.Property(e => e.Passwords)
  106. .HasMaxLength(30)
  107. .HasColumnName("passwords");
  108. entity.Property(e => e.Sname)
  109. .HasMaxLength(30)
  110. .HasColumnName("sname");
  111. entity.HasOne(d => d.GenderNavigation).WithMany(p => p.Users)
  112. .HasForeignKey(d => d.Gender)
  113. .HasConstraintName("users_gender_fkey");
  114. entity.HasOne(d => d.IdrolesNavigation).WithMany(p => p.Users)
  115. .HasForeignKey(d => d.Idroles)
  116. .HasConstraintName("users_idroles_fkey");
  117. });
  118. OnModelCreatingPartial(modelBuilder);
  119. }
  120. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  121. }