Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/surgicalcoder/RazorPageRouteGenerator
Strongly typed Razor Page Route Generator (also works with Blazor)
https://github.com/surgicalcoder/RazorPageRouteGenerator
Last synced: about 1 month ago
JSON representation
Strongly typed Razor Page Route Generator (also works with Blazor)
- Host: GitHub
- URL: https://github.com/surgicalcoder/RazorPageRouteGenerator
- Owner: surgicalcoder
- License: mit
- Created: 2021-12-11T13:38:23.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-22T12:39:19.000Z (6 months ago)
- Last Synced: 2024-11-01T12:05:01.013Z (about 1 month ago)
- Language: C#
- Size: 293 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - RazorPageRouteGenerator
- csharp-source-generators - RazorPageRouteGenerator - ![stars](https://img.shields.io/github/stars/surgicalcoder/RazorPageRouteGenerator?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/surgicalcoder/RazorPageRouteGenerator?style=flat-square&cacheSeconds=86400) Generates methods with parameters for Razor and Blazor pages, so you can navigate without having to guess URLs or parameters. (Source Generators / Webprogramming)
- awesome-blazor - RazorPageRouteGenerator - ![GitHub stars](https://img.shields.io/github/stars/surgicalcoder/RazorPageRouteGenerator?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/surgicalcoder/RazorPageRouteGenerator?style=flat-square&cacheSeconds=86400) Generates methods with parameters for Razor and Blazor pages, so you can navigate without having to guess URLs or parameters. (Source generators / Others)
README
This will generate you a class, that has strongly typed methods, that will represent Razor and Blazor Page routes. You can then use this to navigate to those URLs. Also supports some forms of parameters in the URLs.
# How to use
Firstly, add the project from Nuget - [GoLive.Generator.RazorPageRoute](https://www.nuget.org/packages/GoLive.Generator.RazorPageRoute/), then add an AdditionalFile in your .csproj named "RazorPageRoutes.json", like so:
```
```
If you are using .net 6, you need to disable Razor Source Code Generation, due to the way that generators are called. You can do this by inserting
```
false
```
Into an ItemGroup.Once that's done, add the settings file and change as required:
```
{
"Namespace": "GoLive.Generator.RazorPageRoute.Tests.BlazorWebAsssembly",
"ClassName": "PageRoutes",
"OutputToFile": "PageRoutes.cs",
"OutputLastCreatedTime": false,
"OutputExtensionMethod" : true
}
```For `OutputFile` the path will be calculated as relative, so you can put in `..\WebAssembly\File.cs`