转移.net core 3.1,为.NET 5做准备

This commit is contained in:
ÂëÉñ
2020-10-22 14:59:36 +08:00
parent fd9bca23a7
commit a35d596237
1080 changed files with 175912 additions and 185681 deletions

View File

@@ -0,0 +1,22 @@
using System;
namespace Infrastructure.Extensions.AutofacManager
{
/// <summary>
/// 提供全局静态获取服务的能力。
/// <para>例AutofacContainerModule.GetService<IPathProvider>()</para>
/// </summary>
public class AutofacContainerModule
{
static private IServiceProvider _provider;
public static void ConfigServiceProvider(IServiceProvider serviceProvider)
{
_provider = serviceProvider;
}
public static TService GetService<TService>() where TService:class
{
Type typeParameterType = typeof(TService);
return (TService)_provider.GetService(typeParameterType);
}
}
}