Suiram1.BlazorRoutesGenerator 1.0.0

dotnet add package Suiram1.BlazorRoutesGenerator --version 1.0.0                
NuGet\Install-Package Suiram1.BlazorRoutesGenerator -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Suiram1.BlazorRoutesGenerator" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Suiram1.BlazorRoutesGenerator --version 1.0.0                
#r "nuget: Suiram1.BlazorRoutesGenerator, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Suiram1.BlazorRoutesGenerator as a Cake Addin
#addin nuget:?package=Suiram1.BlazorRoutesGenerator&version=1.0.0

// Install Suiram1.BlazorRoutesGenerator as a Cake Tool
#tool nuget:?package=Suiram1.BlazorRoutesGenerator&version=1.0.0                

BlazorRoutesGenerator

This library provides a code generator that detects routable components in .cs or in .razor files and create har-coded routes based on them. The code generator will be recognize @page-directive in .razor files and the [Route("/")]-attribute in .cs files.
For each route defined by one of the mentioned ways the generator will generate two method. The first one will generate an relative uri to the page and the second one is an extensions of NavigationManager that will navigate to this page. The extension has the same method name as the uri creator method but with the prefix NavigateTo.

Route parameters

The generated methods supports route parameters of every by ASP.NET Core supported route parameter. A recognized route parameters gets in both methods of his route a parameter were you can specify this parameter.

Query parameters

The generated methods supports query parameter as well. Query parameters of a page are recognized when a property has the [SupplyParameterFromQuery]-attribute.
The name of the query parameter can provided using the Name-property of the attribute. If this property isn't specified the name of the property will be used.
The type of the query parameter is determined by the type of the property. Complex query parameters won't get serialized and only the ToString get called.

Generated methods

Every method generated is inside of the static class named Routes inside the application root namespace. The name of the methods is determined by the class/file name. If two classes/files has the same names as little as possible from the namespace is used to clearly identify the page.
For example the page ../Pages/Index.razor has the method name Index. But when there are two pages ../Pages/SectionA/Index.razor and ../Pages/SectionB/Index.razor the method names of these pages are SectionAIndex and SectionBIndex. In .razor files is for that purpose also the @namespace-directive supported.

Limitations

Query parameters are only in .cs files supported. Inside of .razor files they won't be detected. In case that you want to use .razor files for HTML + CS and query parameters you can define the page in partial classes (more about that here) and define the query parameters there.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 62 7/18/2024