Program.cs 3.0 KB

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