获取所有路由
public void 获取所有路由([FromServices] IHttpContextAccessor httpContextAccessor
, [FromServices] ApplicationPartManager part
, [FromServices] IActionDescriptorCollectionProvider provider
, [FromServices] IApiDescriptionGroupCollectionProvider provider2
, [FromServices] IEnumerable<EndpointDataSource> sources)
{
var router = httpContextAccessor.HttpContext.Features.Get<IRouteValuesFeature>();
var router2 = httpContextAccessor.HttpContext.Features.Get<IEndpointFeature>();
var controllerFeature = new ControllerFeature();
part.PopulateFeature(controllerFeature);
var x = provider.ActionDescriptors.Items;
var z = provider2.ApiDescriptionGroups.Items;
var b = router.RouteValues;
var c = router2.Endpoint;
}
如果您觉得本文对你有用,不妨帮忙点个赞,或者在评论里给我一句赞美,小小成就都是今后继续为大家编写优质文章的动力,百小僧拜谢!
欢迎您持续关注我的博客:)
版权所有,欢迎保留原文链接进行转载:)