| 123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- namespace Net6Demo_Api.Util
- {
- public static class GlobalData
- {
- static GlobalData()
- {
- string rootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)??"";
- AllFxAssemblies = Directory.GetFiles(rootPath, "Net6Demo_Api*.dll")
- .Select(x => Assembly.LoadFrom(x))
- .Where(x => !x.IsDynamic)
- .ToList();
- AllFxTypes= AllFxAssemblies.SelectMany(x => x.GetTypes()).Where(x => !x.IsAbstract && x.IsClass).ToList();
- }
- /// <summary>
- /// 解决方案所有程序集
- /// </summary>
- public static readonly List<Assembly> AllFxAssemblies;
- /// <summary>
- /// 解决方案所有自定义类
- /// </summary>
- public static readonly List<Type> AllFxTypes = new List<Type>();
- }
- }
|