优化功能

This commit is contained in:
不做码农
2023-06-01 18:47:11 +08:00
parent 68d43240e7
commit 65543e651c
4 changed files with 33 additions and 7 deletions

View File

@@ -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);