mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-28 12:46:36 +08:00
数据权限功能
This commit is contained in:
27
Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs
Normal file
27
Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using Ubiety.Dns.Core.Common;
|
||||
|
||||
namespace Yi.Framework.WebCore
|
||||
{
|
||||
public static class ServiceLocator
|
||||
{
|
||||
public static IServiceProvider Instance { get; set; }
|
||||
|
||||
public static string Admin { get; set; } = "cc";
|
||||
|
||||
public static bool GetHttp(out HttpContext httpContext)
|
||||
{
|
||||
httpContext = null;
|
||||
var httpContextAccessor = Instance.GetService<IHttpContextAccessor>();
|
||||
if (httpContextAccessor is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
httpContext = httpContextAccessor.HttpContext;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user