OpenAuth.Net/Infrastructure/Extensions/AutofacManager/AutofacContainerModule.cs
yubaolee 9fd0405721 同步openauth.Core:
采用代码生成器的表结构控制前端显示,删除以前按照dbset获取数据库结构
优化注释
升级EF及所有三方的版本
2021-10-18 00:42:29 +08:00

23 lines
712 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
namespace Infrastructure.Extensions.AutofacManager
{
/// <summary>
/// 提供全局静态获取服务的能力。
/// <para>例AutofacContainerModule.GetService&lt;IPathProvider&gt;()</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);
}
}
}