using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace EntrustSettle.Common.Core;
///
/// 内部只用于初始化使用
///
public static class InternalApp
{
internal static IServiceCollection InternalServices;
/// 根服务
internal static IServiceProvider RootServices;
/// 获取Web主机环境
internal static IWebHostEnvironment WebHostEnvironment;
/// 获取泛型主机环境
internal static IHostEnvironment HostEnvironment;
/// 配置对象
internal static IConfiguration Configuration;
public static void ConfigureApplication(this WebApplicationBuilder wab)
{
HostEnvironment = wab.Environment;
WebHostEnvironment = wab.Environment;
InternalServices = wab.Services;
}
public static void ConfigureApplication(this IConfiguration configuration)
{
Configuration = configuration;
}
public static void ConfigureApplication(this IHost app)
{
RootServices = app.Services;
}
}