ShopPlatform.Web
1.0.0.0
농산물, 소프트웨어 라이선스와 개발 용역을 직접 판매하는 CodeMaru 직영 쇼핑몰입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
TenantMiddleware.cs
이 파일의 문서화 페이지로 가기
1
using
ShopPlatform.Services
;
2
3
namespace
ShopPlatform.Middleware
;
4
13
public
sealed
class
TenantMiddleware
14
{
23
private
static
readonly HashSet<string>
_reserved
=
new
(StringComparer.OrdinalIgnoreCase)
24
{
25
"admin"
,
"healthz"
,
"_blazor"
,
"_framework"
,
"_content"
,
"favicon.ico"
,
"robots.txt"
,
"sitemap.xml"
26
};
27
36
private
readonly RequestDelegate
_next
;
37
54
public
TenantMiddleware
(RequestDelegate next) =>
_next
= next;
55
96
public
async Task
InvokeAsync
(HttpContext ctx,
TenantContext
tenantCtx,
IShopTenantStore
store)
97
{
98
var path = ctx.Request.Path.Value ??
"/"
;
99
var segments = path.TrimStart(
'/'
).Split(
'/'
, 2);
100
var slug = segments[0];
101
102
if
(!
string
.IsNullOrEmpty(slug) && !
_reserved
.Contains(slug))
103
{
104
var config = await store.
GetAsync
(slug);
105
if
(config !=
null
)
106
tenantCtx.Config = config;
107
}
108
109
await
_next
(ctx);
110
}
111
}
ShopPlatform.Middleware
Definition
OgBotMiddleware.cs:4
ShopPlatform.Services
Definition
CartService.cs:3
ShopPlatform.Middleware.TenantMiddleware.InvokeAsync
async Task InvokeAsync(HttpContext ctx, TenantContext tenantCtx, IShopTenantStore store)
Definition
TenantMiddleware.cs:96
ShopPlatform.Middleware.TenantMiddleware._next
readonly RequestDelegate _next
Definition
TenantMiddleware.cs:36
ShopPlatform.Middleware.TenantMiddleware.TenantMiddleware
TenantMiddleware(RequestDelegate next)
Definition
TenantMiddleware.cs:54
ShopPlatform.Middleware.TenantMiddleware._reserved
static readonly HashSet< string > _reserved
Definition
TenantMiddleware.cs:23
ShopPlatform.Services.IShopTenantStore
Definition
IShopTenantStore.cs:14
ShopPlatform.Services.IShopTenantStore.GetAsync
Task< ShopConfig?> GetAsync(string slug)
ShopPlatform.Services.TenantContext
Definition
TenantContext.cs:14
Middleware
TenantMiddleware.cs
다음에 의해 생성됨 :
1.17.0