⚡ 优化功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -16,7 +17,11 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
/// <param name="services"></param>
|
||||
public static void AddAppService(this IServiceCollection services)
|
||||
{
|
||||
string[] cls = new string[] { "ZR.Repository", "ZR.Service", "ZR.Tasks" };
|
||||
var cls = AppSettings.Get<string[]>("InjectClass");
|
||||
if (cls == null || cls.Length <= 0)
|
||||
{
|
||||
throw new Exception("请更新appsettings类");
|
||||
}
|
||||
foreach (var item in cls)
|
||||
{
|
||||
Register(services, item);
|
||||
|
||||
@@ -61,8 +61,8 @@ builder.Services.AddAuthentication(options =>
|
||||
});
|
||||
|
||||
//InternalApp.InternalServices = builder.Services;
|
||||
builder.Services.AddAppService();
|
||||
builder.Services.AddSingleton(new AppSettings(builder.Configuration));
|
||||
builder.Services.AddAppService();
|
||||
//开启计划任务
|
||||
builder.Services.AddTaskSchedulers();
|
||||
//初始化db
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
"SecretKey": "SecretKey-ZRADMIN.NET-20210101",
|
||||
"Expire": 1440 //jwt登录过期时间(分)
|
||||
},
|
||||
"InitDb": false,//是否初始化db
|
||||
"InjectClass": [ "ZR.Repository", "ZR.Service", "ZR.Tasks" ],//自动注入类
|
||||
"InitDb": false, //是否初始化db
|
||||
"DemoMode": false, //是否演示模式
|
||||
"Upload": {
|
||||
"uploadUrl": "http://localhost:8888", //本地存储资源访问路径
|
||||
|
||||
Reference in New Issue
Block a user