This commit is contained in:
Dai Mr 2024-09-30 23:30:03 +08:00
parent 6976bc645e
commit 8a50a5eb81

View File

@ -12,7 +12,7 @@ namespace Microsoft.Extensions.DependencyInjection
{ {
public static class DependencyInjectionExtensions public static class DependencyInjectionExtensions
{ {
public static void ServiceRegister(this IServiceCollection services,params Assembly[] assemblies) public static void ServiceRegister(this IServiceCollection services, params Assembly[] assemblies)
{ {
if (assemblies.Length <= 0) if (assemblies.Length <= 0)
{ {
@ -61,7 +61,7 @@ namespace Microsoft.Extensions.DependencyInjection
} }
} }
public static void PluginServiceRegister(this IServiceCollection services,string pluginPath="") public static void PluginServiceRegister(this IServiceCollection services, string pluginPath = "")
{ {
if (pluginPath.IsNullOrWhiteSpace()) if (pluginPath.IsNullOrWhiteSpace())
{ {
@ -74,6 +74,8 @@ namespace Microsoft.Extensions.DependencyInjection
public static IEnumerable<Assembly> GetAssembliesFromFolder(string folderPath) public static IEnumerable<Assembly> GetAssembliesFromFolder(string folderPath)
{ {
var directory = new DirectoryInfo(folderPath); var directory = new DirectoryInfo(folderPath);
if (!directory.Exists) return Enumerable.Empty<Assembly>();
var files = directory.GetFiles("*.dll"); var files = directory.GetFiles("*.dll");
var assemblies = new List<Assembly>(); var assemblies = new List<Assembly>();