控制器基类数据库非必选
This commit is contained in:
parent
256c00cfe2
commit
a9a592463d
|
@ -35,7 +35,7 @@ namespace Falcon.SugarApi.ApiDefinistions
|
|||
/// <summary>
|
||||
/// Sugar数据库
|
||||
/// </summary>
|
||||
public SugarDbContext SugarDb { get; set; }
|
||||
public SugarDbContext? SugarDb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用程序跟目录
|
||||
|
@ -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<SugarDbContext>() ?? throw new NullReferenceException("SugarDbContext");
|
||||
this.SugarDb = service.GetService<SugarDbContext>();
|
||||
this.Cache = service.GetService<IDistributedCache>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user