ShoeShopContext.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.EntityFrameworkCore;
  4. namespace ShoeShopMvc.Models;
  5. public partial class ShoeShopContext : DbContext
  6. {
  7. public ShoeShopContext()
  8. {
  9. }
  10. public ShoeShopContext(DbContextOptions<ShoeShopContext> options)
  11. : base(options)
  12. {
  13. }
  14. public virtual DbSet<Category> Categories { get; set; }
  15. public virtual DbSet<Edizm> Edizms { get; set; }
  16. public virtual DbSet<Manufacture> Manufactures { get; set; }
  17. public virtual DbSet<Order> Orders { get; set; }
  18. public virtual DbSet<OrderProduct> OrderProducts { get; set; }
  19. public virtual DbSet<PickPoint> PickPoints { get; set; }
  20. public virtual DbSet<Product> Products { get; set; }
  21. public virtual DbSet<Role> Roles { get; set; }
  22. public virtual DbSet<Supplier> Suppliers { get; set; }
  23. public virtual DbSet<User> Users { get; set; }
  24. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  25. #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.
  26. => optionsBuilder.UseSqlServer("Server=DESKTOP-7S4CGG7\\SQLEXPRESS;Database=826;Trusted_Connection=True;TrustServerCertificate=True;");
  27. protected override void OnModelCreating(ModelBuilder modelBuilder)
  28. {
  29. modelBuilder.Entity<Category>(entity =>
  30. {
  31. entity.ToTable("Category");
  32. entity.Property(e => e.CategoryId)
  33. .HasMaxLength(50)
  34. .HasColumnName("category_id");
  35. entity.Property(e => e.CategoryName)
  36. .HasMaxLength(50)
  37. .HasColumnName("category_name");
  38. });
  39. modelBuilder.Entity<Edizm>(entity =>
  40. {
  41. entity.HasKey(e => e.IdEdIzm);
  42. entity.ToTable("edizm");
  43. entity.Property(e => e.IdEdIzm)
  44. .HasMaxLength(50)
  45. .HasColumnName("id_ed_izm");
  46. entity.Property(e => e.EdIzm1)
  47. .HasMaxLength(50)
  48. .HasColumnName("ed_izm");
  49. });
  50. modelBuilder.Entity<Manufacture>(entity =>
  51. {
  52. entity.ToTable("Manufacture");
  53. entity.Property(e => e.ManufactureId)
  54. .HasMaxLength(50)
  55. .HasColumnName("manufacture_id");
  56. entity.Property(e => e.ManufactureName)
  57. .HasMaxLength(50)
  58. .HasColumnName("manufacture_name");
  59. });
  60. modelBuilder.Entity<Order>(entity =>
  61. {
  62. entity.HasKey(e => e.OrdersId);
  63. entity.Property(e => e.OrdersId)
  64. .HasMaxLength(50)
  65. .HasColumnName("orders_id");
  66. entity.Property(e => e.ClientId)
  67. .HasMaxLength(50)
  68. .HasColumnName("client_id");
  69. entity.Property(e => e.Cod).HasColumnName("cod");
  70. entity.Property(e => e.DeliveryDate).HasColumnName("delivery_date");
  71. entity.Property(e => e.OrdersDate)
  72. .HasMaxLength(50)
  73. .HasColumnName("orders_date");
  74. entity.Property(e => e.AddressPickpoints)
  75. .HasMaxLength(50)
  76. .HasColumnName("PickPoints_id");
  77. entity.Property(e => e.StatusId)
  78. .HasMaxLength(50)
  79. .HasColumnName("status_id");
  80. });
  81. modelBuilder.Entity<OrderProduct>(entity =>
  82. {
  83. entity.HasKey(e => e.OrderProductsId);
  84. entity.ToTable("OrderProduct");
  85. entity.Property(e => e.OrderProductsId)
  86. .HasMaxLength(50)
  87. .HasColumnName("OrderProducts_id");
  88. entity.Property(e => e.Article)
  89. .HasMaxLength(50)
  90. .HasColumnName("article");
  91. entity.Property(e => e.Colvo)
  92. .HasMaxLength(50)
  93. .HasColumnName("colvo");
  94. entity.Property(e => e.OrdersId)
  95. .HasMaxLength(50)
  96. .HasColumnName("orders_id");
  97. });
  98. modelBuilder.Entity<PickPoint>(entity =>
  99. {
  100. entity.HasKey(e => e.PickPointsId);
  101. entity.Property(e => e.PickPointsId)
  102. .HasMaxLength(50)
  103. .HasColumnName("PickPoints_id");
  104. entity.Property(e => e.AddressPickpoints)
  105. .HasMaxLength(50)
  106. .HasColumnName("Address_pickpoints");
  107. });
  108. modelBuilder.Entity<Product>(entity =>
  109. {
  110. entity.HasKey(e => e.Article);
  111. entity.ToTable("Product");
  112. entity.Property(e => e.Article)
  113. .HasMaxLength(50)
  114. .HasColumnName("article");
  115. entity.Property(e => e.CategoryId)
  116. .HasMaxLength(50)
  117. .HasColumnName("category_id");
  118. entity.Property(e => e.Colvo)
  119. .HasMaxLength(50)
  120. .HasColumnName("colvo");
  121. entity.Property(e => e.EdIzm)
  122. .HasMaxLength(50)
  123. .HasColumnName("ed_izm");
  124. entity.Property(e => e.Image)
  125. .HasMaxLength(50)
  126. .HasColumnName("image");
  127. entity.Property(e => e.ManufactureId)
  128. .HasMaxLength(50)
  129. .HasColumnName("manufacture_id");
  130. entity.Property(e => e.OpisanieProduct)
  131. .HasMaxLength(100)
  132. .HasColumnName("opisanie_product");
  133. entity.Property(e => e.Price).HasColumnName("price");
  134. entity.Property(e => e.ProductName)
  135. .HasMaxLength(50)
  136. .HasColumnName("product_name");
  137. entity.Property(e => e.Skidka).HasColumnName("skidka");
  138. entity.Property(e => e.SupplierId)
  139. .HasMaxLength(50)
  140. .HasColumnName("supplier_id");
  141. });
  142. modelBuilder.Entity<Role>(entity =>
  143. {
  144. entity.Property(e => e.RoleId)
  145. .HasMaxLength(50)
  146. .HasColumnName("role_id");
  147. entity.Property(e => e.RoleName)
  148. .HasMaxLength(50)
  149. .HasColumnName("role_name");
  150. });
  151. modelBuilder.Entity<Supplier>(entity =>
  152. {
  153. entity.ToTable("suppliers");
  154. entity.Property(e => e.SupplierId)
  155. .HasMaxLength(50)
  156. .HasColumnName("supplier_id");
  157. entity.Property(e => e.SupplierName)
  158. .HasMaxLength(50)
  159. .HasColumnName("supplier_name");
  160. });
  161. modelBuilder.Entity<User>(entity =>
  162. {
  163. entity.Property(e => e.UserId)
  164. .HasMaxLength(50)
  165. .HasColumnName("user_id");
  166. entity.Property(e => e.Fio)
  167. .HasMaxLength(50)
  168. .HasColumnName("FIO");
  169. entity.Property(e => e.Login).HasMaxLength(50);
  170. entity.Property(e => e.Password).HasMaxLength(50);
  171. entity.Property(e => e.RoleId)
  172. .HasMaxLength(50)
  173. .HasColumnName("role_id");
  174. });
  175. OnModelCreatingPartial(modelBuilder);
  176. }
  177. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  178. }