Ver Fonte

!1712 代码生成器增加插件实体获取
Merge pull request !1712 from 冰魄少年/v2

zuohuaijun há 1 ano atrás
pai
commit
01863a51e1

+ 10 - 0
Admin.NET/Admin.NET.Core/Service/DataBase/SysDatabaseService.cs

@@ -563,6 +563,16 @@ public class SysDatabaseService : IDynamicApiController, ITransient
     private static string GetEntityTargetPath(CreateEntityInput input)
     {
         var backendPath = Path.Combine(new DirectoryInfo(App.WebHostEnvironment.ContentRootPath).Parent.FullName, input.Position, "Entity");
+        if (!Directory.Exists(backendPath))
+        {
+            var pluginsPath = App.GetConfig<string[]>("AppSettings:ExternalAssemblies");
+            foreach (var pluginPath in pluginsPath)
+            {
+                backendPath = Path.Combine(new DirectoryInfo(App.WebHostEnvironment.ContentRootPath).Parent.FullName, pluginPath, input.Position, "Entity");
+                if (Directory.Exists(backendPath))
+                    break;
+            }
+        }
         if (!Directory.Exists(backendPath))
             Directory.CreateDirectory(backendPath);
         return Path.Combine(backendPath, input.EntityName + ".cs");