diff --git a/Falcon.SugarApi/ApiDefinistions/ApiControllerBase.cs b/Falcon.SugarApi/ApiDefinistions/ApiControllerBase.cs index a8e3e1c..0a5deee 100644 --- a/Falcon.SugarApi/ApiDefinistions/ApiControllerBase.cs +++ b/Falcon.SugarApi/ApiDefinistions/ApiControllerBase.cs @@ -35,7 +35,7 @@ namespace Falcon.SugarApi.ApiDefinistions /// /// Sugar数据库 /// - public SugarDbContext SugarDb { get; set; } + public SugarDbContext? SugarDb { get; set; } /// /// 应用程序跟目录 @@ -59,7 +59,7 @@ namespace Falcon.SugarApi.ApiDefinistions protected ApiControllerBase(IServiceProvider service) { this.Services = service; this.Logger = service.GetService(typeof(ILogger<>).MakeGenericType(GetType())) as ILogger ?? throw new NullReferenceException("ILogger"); - this.SugarDb = service.GetService() ?? throw new NullReferenceException("SugarDbContext"); + this.SugarDb = service.GetService(); this.Cache = service.GetService(); }