Program.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using OASystem.Domain.Entities;
  2. using OASystem.Domain.Entities.Business;
  3. using OASystem.Domain.Entities.Customer;
  4. using OASystem.Domain.Entities.Groups;
  5. using OASystem.Domain.Entities.Resource;
  6. using OASystem.Domain.Entities.System;
  7. using SqlSugar;
  8. var db = new SqlSugarClient(new ConnectionConfig()
  9. {
  10. ConnectionString = "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;",
  11. DbType = SqlSugar.DbType.SqlServer,
  12. IsAutoCloseConnection = true,
  13. InitKeyType = InitKeyType.Attribute
  14. });
  15. #region Aop
  16. //db.Aop.OnLogExecuting = (sql, pars) =>
  17. //{
  18. // Console.WriteLine(sql + "" + Db.Utilities.SerializeObject
  19. // (pars.ToDictionary(it => it.ParameterName, it => it.Value)));
  20. // Console.WriteLine();
  21. //};
  22. #endregion
  23. #region 对话框
  24. Console.WriteLine("是否确定同步数据库表结构?(同名数据表将会被备份,生产环境慎用,回车确认)");
  25. var str = Console.ReadKey();
  26. if (str.Key == ConsoleKey.Enter)
  27. {
  28. Console.WriteLine("同步中,请稍后...");
  29. }
  30. else
  31. {
  32. Console.WriteLine("\r\n输入错误,已退出...");
  33. return;
  34. }
  35. #endregion
  36. //同步数据表结构
  37. db.DbMaintenance.CreateDatabase();
  38. db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
  39. {
  40. //typeof(Sys_PageFunctionPermission)
  41. //,typeof(Sys_SystemMenuAndFunction)
  42. //,typeof(Sys_SystemMenuPermission)
  43. //,typeof(Sys_JobPostAuthority)
  44. //,typeof(Sys_UserAuthority)
  45. //typeof(Crm_CustomerCert),
  46. //typeof(Crm_CustomerCompany),
  47. //typeof(Crm_CustomerFile),
  48. //typeof(Crm_DeleClient)
  49. //typeof(Crm_VisaCustomerCompany),
  50. //typeof(Crm_VisaCustomerFamily),
  51. //typeof(Crm_VisaCustomerSchool)
  52. //typeof(Grp_AirInquiry),
  53. //typeof(Grp_AirPrice),
  54. //typeof(Grp_CreditCardPayment),
  55. //typeof(Grp_DeleFile),
  56. //typeof(Grp_DelegationInfo),
  57. //typeof(Grp_DelegationJoinCustomer),
  58. //typeof(Grp_DeleMeetingNeeds),
  59. //typeof(Grp_HotelReservations),
  60. //typeof(Grp_VisaProgress),
  61. //typeof(Grp_DeleClientNeeds),
  62. //typeof(Res_AirCompany),
  63. //typeof(Res_AirTicketAgent),
  64. //typeof(Res_HotelData),
  65. //typeof(Res_ThreeCode)
  66. //typeof(Res_ScenicSpotInfo),
  67. //typeof(Res_CarGuides),
  68. //typeof(Res_CarInfo),
  69. //typeof(Res_GuidesInfo)
  70. //typeof(Res_CarData),
  71. //typeof(Res_LocalGuideData)
  72. //typeof(Grp_ScheduleInfo),
  73. //typeof(Grp_ScheduleDetailInfo),
  74. //typeof(Grp_SchedulePersonInfo)
  75. //typeof(Sys_Message),
  76. //typeof(Sys_MessageReadAuth)
  77. //typeof(Crm_DeleClient)
  78. //typeof(Crm_NewClientData)
  79. //typeof(Crm_ClientDataAndUser),
  80. //typeof(Crm_ClientDataAndBusiness),
  81. //typeof(Res_ItemDetailInfo),
  82. //typeof(Res_ItemVendor)
  83. typeof(Bus_ConfItemInfo)
  84. //typeof(Res_CountryFeeCost)
  85. });
  86. Console.WriteLine("数据库结构同步完成!");