LFlow/LFlow.Base/App.cs

31 lines
721 B
C#
Raw Normal View History

2024-10-31 10:38:21 +08:00
using System.Reflection;
2024-10-16 11:35:05 +08:00
namespace LFlow.Base;
/// <summary>
/// 程序对象
/// </summary>
public class App
{
2024-11-04 10:10:05 +08:00
/// <summary>
/// 服务集合
/// </summary>
2024-10-19 08:32:33 +08:00
internal static IServiceCollection? services;
2024-11-04 10:10:05 +08:00
/// <summary>
/// 服务提供者
/// </summary>
2024-10-16 11:35:05 +08:00
private static IServiceProvider? ServiceProvider => services?.BuildServiceProvider();
2024-11-04 10:10:05 +08:00
/// <summary>
/// 获取服务
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
2024-10-16 11:35:05 +08:00
public static T? GetService<T>()
{
return ServiceProvider!.GetService<T>();
}
2024-11-04 10:10:05 +08:00
/// <summary>
/// 子服务程序集
/// </summary>
2024-10-31 10:38:21 +08:00
public static List<Assembly> SubServiceAssembly = [];
2024-10-16 11:35:05 +08:00
}