LFlow/LFlow.Base/App.cs

31 lines
721 B
C#

using System.Reflection;
namespace LFlow.Base;
/// <summary>
/// 程序对象
/// </summary>
public class App
{
/// <summary>
/// 服务集合
/// </summary>
internal static IServiceCollection? services;
/// <summary>
/// 服务提供者
/// </summary>
private static IServiceProvider? ServiceProvider => services?.BuildServiceProvider();
/// <summary>
/// 获取服务
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T? GetService<T>()
{
return ServiceProvider!.GetService<T>();
}
/// <summary>
/// 子服务程序集
/// </summary>
public static List<Assembly> SubServiceAssembly = [];
}