Routeslist
v1.1.2.1
RoutesListは、.NETアプリケーションのすべてのルートを明確で簡潔な方法で見ることができる便利なツールです。ルートのメソッド、URI、コントローラー、アクション、ミドルウェアを簡単に検査し、ニーズに合わせて出力をカスタマイズできます。 RoutesListは、.NET Core App 3.1、.Net5.0、.Net 6、.Net7.0、Razor Pages、ASP.NET MVC、Blazor Serverプロジェクトで動作します。
互換性::




nuget.orgから
Install-Package RoutesList services.AddRoutesListをService configureServiceメソッドに追加するだけです。
例:
startup.cs
\ .. .
public void ConfigureServices ( IServiceCollection services )
{
\ .. .
services . AddRoutesList ( ) ;
}メソッドの構成に追加します
例:
startup.cs
\ .. .
public void Configure (
IApplicationBuilder app ,
IWebHostEnvironment env ,
)
{
\ .. .
app . UseRoutesList ( ) ;
}デフォルトのエンドポイント: http://your_application_address/routes
例:
Program.CS
using RoutesList . Gen ;
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddRoutesList ( ) ; < -- usage
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) ) {
app . UseExceptionHandler ( "/Error" ) ;
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseRouting ( ) ;
app . UseAuthorization ( ) ;
app . MapRazorPages ( ) ;
app . UseRoutesList ( ) ; < -- usage
app . Run ( ) ;
public partial class Program { } public class Program
{
public static void Main ( string [ ] args )
{
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddServerSideBlazor ( ) ;
builder . Services . AddSingleton < WeatherForecastService > ( ) ;
builder . Services . AddRoutesList ( ) ;
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) ) {
app . UseExceptionHandler ( "/Error" ) ;
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseRouting ( ) ;
app . MapBlazorHub ( ) ;
app . MapFallbackToPage ( "/_Host" ) ;
app . UseRoutesList ( options => {
options . SetAppAssembly ( typeof ( Program ) . Assembly ) ; < -- setup current application webassembly with blazor component
} ) ;
app . Run ( ) ;
}
} app.userouteslistでは、オプションを渡すことができます
| 名前 | 説明 |
|---|---|
| 終点 | エンドポイント名 |
| タイトル | Webサイトのタイトル |
| SETTABLECLASSES | テーブルのテンプレートクラスを追加します |
| SetAppAssembly | Blazorコンポーネントとともに現在のアプリケーションアセンブリを設定します |
startup.cs
public void Configure (
IApplicationBuilder app ,
IWebHostEnvironment env ,
)
{
IDictionary < string , string [ ] > dict = new Dictionary < string , string [ ] > ( ) ;
string [ ] classes = dict [ "table" ] = new string [ 2 ] { "table" , "table-striped" } ;
app . UseRoutesList ( options => {
options . Endpoint = "your_new_endpoints" ;
options . Tittle = "Your new Title for site" ;
options . SetTableClasses ( classes ) ;
options . SetAppAssembly ( typeof ( Program ) . Assembly )
} ) ;
}Program.CS
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddControllersWithViews ( ) ;
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) )
{
app . UseExceptionHandler ( "/Error" ) ;
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseAuthorization ( ) ;
app . MapGet ( "/hi" , ( ) => "Hello!" ) ;
app . MapDefaultControllerRoute ( ) ;
app . MapRazorPages ( ) ;
app . UseRoutesList ( options => {
options . Endpoint = "your_new_endpoints" ;
options . Tittle = "Your new Title for site" ;
options . SetTableClasses ( classes ) ;
options . SetAppAssembly ( typeof ( Program ) . Assembly )
} ) ;
app . Run ( ) ; 新しい機能の追加/提案、バグ修正、新しいファイル形式の文書化、単に文法の編集など、貢献はいつでも歓迎されます。これについては、新しいgithubの問題と説明を作成し、問題タグを追加してバグ/エンハンスメントを追加します