using Furion; using Microsoft.Extensions.DependencyInjection; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPA.KitChen.GroupMeal.SqlSugar { public static class SqlsugarSetup { /// /// /// /// public static void AddSqlsugarSetup(this IServiceCollection services) { //如果多个数数据库传 List var configConnection = new ConnectionConfig() { DbType = DbType.MySql, ConnectionString = App.Configuration["DBConnectionStr"], IsAutoCloseConnection = true }; var sqlSugar = SqlSugarDb.SqlSugarScope(configConnection); services.AddSingleton(sqlSugar);//这边是SqlSugarScope用AddSingleton var sqlSugarLog = SqlSugarDb.SqlSugarScopeLog(new ConnectionConfig() { DbType = DbType.MySql, ConnectionString = App.Configuration["DBConnectionLogStr"], IsAutoCloseConnection = true }); services.AddSingleton(sqlSugarLog);//这边是SqlSugarScope用AddSingleton } } }