Program.cs 2.6 KB

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