namespace HuanMeng.DotNetCore.Base
{
    public class DaoBase
    {
        /// <summary>
        /// _serviceProvider,提供基本依赖注入支持
        /// </summary>
        protected readonly IServiceProvider _serviceProvider;

        ///// <summary>
        ///// 构造函数
        ///// </summary>
        //public DaoBase() 
        //{
        //    // 创建一个空的ServiceCollection
        //    var webApplication = WebApplication.Current;
        //    var services = new ServiceCollection();

        //    // 创建ServiceProvider实例
        //    _serviceProvider = services.BuildServiceProvider();
        //}

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="serviceProvider"></param>
        public DaoBase(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }
    }
}
