Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

Awesome Lists containing this project

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`