You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// 内部只用于初始化使用
|
|
/// </summary>
|
|
public static class InternalApp
|
|
{
|
|
internal static IServiceCollection InternalServices;
|
|
|
|
/// <summary>根服务</summary>
|
|
internal static IServiceProvider RootServices;
|
|
|
|
/// <summary>获取Web主机环境</summary>
|
|
internal static IWebHostEnvironment WebHostEnvironment;
|
|
|
|
/// <summary>获取泛型主机环境</summary>
|
|
internal static IHostEnvironment HostEnvironment;
|
|
|
|
/// <summary>配置对象</summary>
|
|
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;
|
|
}
|
|
} |