团餐订单
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 regels
1.4 KiB

  1. using Furion;
  2. using Microsoft.Extensions.DependencyInjection;
  3. using SqlSugar;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPA.KitChen.GroupMealOrder.SqlSugar
  10. {
  11. public static class SqlsugarSetup
  12. {
  13. /// <summary>
  14. ///
  15. /// </summary>
  16. /// <param name="services"></param>
  17. public static void AddSqlsugarSetup(this IServiceCollection services)
  18. {
  19. //如果多个数数据库传 List<ConnectionConfig>
  20. var configConnection = new ConnectionConfig()
  21. {
  22. DbType = DbType.MySql,
  23. ConnectionString = App.Configuration["DBConnectionStr"],
  24. IsAutoCloseConnection = true
  25. };
  26. var sqlSugar = SqlSugarDb.SqlSugarScope(configConnection);
  27. services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton
  28. //如果多个数数据库传 List<ConnectionConfig>
  29. var sqlSugarLog = SqlSugarDb.SqlSugarScopeLog(new ConnectionConfig()
  30. {
  31. DbType = DbType.MySql,
  32. ConnectionString = App.Configuration["DBConnectionLogStr"],
  33. IsAutoCloseConnection = true
  34. });
  35. services.AddSingleton<ISqlSugarClient>(sqlSugarLog);//这边是SqlSugarScope用AddSingleton
  36. }
  37. }
  38. }