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
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        public static void AddSqlsugarSetup(this IServiceCollection services)
        {
            //如果多个数数据库传 List<ConnectionConfig>
            var configConnection = new ConnectionConfig()
            {
                DbType = DbType.MySql,
                ConnectionString = App.Configuration["DBConnectionStr"],
                IsAutoCloseConnection = true
            };
            var sqlSugar = SqlSugarDb.SqlSugarScope(configConnection);
            services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton
        }
    }
}
