OrderSystemContext.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata;
  4. #nullable disable
  5. namespace OrderSystem.Entity
  6. {
  7. public partial class OrderSystemContext : DbContext
  8. {
  9. public OrderSystemContext()
  10. {
  11. }
  12. public OrderSystemContext(DbContextOptions<OrderSystemContext> options)
  13. : base(options)
  14. {
  15. }
  16. public virtual DbSet<CVxIdClientPhoneMerge> CVxIdClientPhoneMerge { get; set; }
  17. public virtual DbSet<VxClientinfo> VxClientinfo { get; set; }
  18. public virtual DbSet<VxContractInfo> VxContractInfo { get; set; }
  19. public virtual DbSet<VxOrderInfo> VxOrderInfo { get; set; }
  20. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  21. {
  22. if (!optionsBuilder.IsConfigured)
  23. {
  24. #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 http://go.microsoft.com/fwlink/?LinkId=723263.
  25. optionsBuilder.UseSqlServer("Server=mes.saierdt.com;User Id=vxRead;Password=123123;Database=LSProduct");
  26. }
  27. }
  28. protected override void OnModelCreating(ModelBuilder modelBuilder)
  29. {
  30. modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS");
  31. modelBuilder.Entity<CVxIdClientPhoneMerge>(entity =>
  32. {
  33. entity.HasNoKey();
  34. entity.ToTable("C_VxIdClientPhoneMerge");
  35. entity.Property(e => e.ClientName)
  36. .HasMaxLength(100)
  37. .IsUnicode(false);
  38. entity.Property(e => e.ClientPhoneNo)
  39. .IsRequired()
  40. .HasMaxLength(100)
  41. .IsUnicode(false);
  42. entity.Property(e => e.ContractNo)
  43. .IsRequired()
  44. .HasMaxLength(50)
  45. .IsUnicode(false);
  46. entity.Property(e => e.VxId)
  47. .IsRequired()
  48. .HasMaxLength(200)
  49. .IsUnicode(false);
  50. });
  51. modelBuilder.Entity<VxClientinfo>(entity =>
  52. {
  53. entity.HasNoKey();
  54. entity.ToView("vx_Clientinfo");
  55. entity.Property(e => e.合同号)
  56. .IsRequired()
  57. .HasMaxLength(50);
  58. entity.Property(e => e.客户号码).HasMaxLength(50);
  59. entity.Property(e => e.客户名称).HasMaxLength(100);
  60. });
  61. modelBuilder.Entity<VxContractInfo>(entity =>
  62. {
  63. entity.HasNoKey();
  64. entity.ToView("vx_ContractInfo");
  65. entity.Property(e => e.合同号)
  66. .IsRequired()
  67. .HasMaxLength(50);
  68. entity.Property(e => e.客户号码).HasMaxLength(50);
  69. entity.Property(e => e.客户名称).HasMaxLength(100);
  70. entity.Property(e => e.订单状态)
  71. .IsRequired()
  72. .HasMaxLength(8)
  73. .IsUnicode(false);
  74. });
  75. modelBuilder.Entity<VxOrderInfo>(entity =>
  76. {
  77. entity.HasNoKey();
  78. entity.ToView("vx_OrderInfo");
  79. entity.Property(e => e.产品).HasMaxLength(50);
  80. entity.Property(e => e.合同号)
  81. .IsRequired()
  82. .HasMaxLength(50);
  83. entity.Property(e => e.客户号码).HasMaxLength(50);
  84. entity.Property(e => e.客户名称).HasMaxLength(100);
  85. entity.Property(e => e.订单号)
  86. .IsRequired()
  87. .HasMaxLength(50);
  88. entity.Property(e => e.订单状态)
  89. .IsRequired()
  90. .HasMaxLength(8)
  91. .IsUnicode(false);
  92. });
  93. OnModelCreatingPartial(modelBuilder);
  94. }
  95. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  96. }
  97. }