Skip to content

Commit

Permalink
Merge pull request #110 from ignatandrei/109-saferouting
Browse files Browse the repository at this point in the history
109 saferouting
  • Loading branch information
ignatandrei authored Sep 23, 2023
2 parents 1fec803 + c6c0219 commit b697ec8
Show file tree
Hide file tree
Showing 119 changed files with 77,753 additions and 75 deletions.
55 changes: 32 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RSCG - 59 Examples of Roslyn Source Code Generators / 6 created by Microsoft /
# RSCG - 60 Examples of Roslyn Source Code Generators / 6 created by Microsoft /

## Latest Update : 2023-09-17 => 17 September 2023
## Latest Update : 2023-09-23 => 23 September 2023

If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)***

Expand All @@ -14,8 +14,24 @@ If you want to help, see below .

## Content

Those are the 59 Roslyn Source Code Generators that I have tested you can see and download source code example.
Those are the 60 Roslyn Source Code Generators that I have tested you can see and download source code example.
( including 6 from Microsoft )
### 60. [SafeRouting](https://ignatandrei.github.io/RSCG_Examples/v2/docs/SafeRouting) generated on : 2023-09-23 => 23 September 2023
<details>
<summary>Expand</summary>
Author: David Wake

Generates strongly-typed route information for ASP.NET Core razor pages and MVC controllers.

Nuget: [https://www.nuget.org/packages/SafeRouting/](https://www.nuget.org/packages/SafeRouting/)


Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/SafeRouting](https://ignatandrei.github.io/RSCG_Examples/v2/docs/SafeRouting)

Source: [https://github.com/daviddotcs/safe-routing](https://github.com/daviddotcs/safe-routing)

</details>

### 59. [SourceGenerator.Helper.CopyCode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/SourceGenerator.Helper.CopyCode) generated on : 2023-09-17 => 17 September 2023
<details>
<summary>Expand</summary>
Expand Down Expand Up @@ -1240,98 +1256,91 @@ Why I have not tested : resource manager to classes. Why I cannot have the resx
https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ResXGenerator&body=https://github.com/ycanardeau/ResXGenerator


29) [SafeRouting,]( https://github.com/daviddotcs/safe-routing) , https://github.com/daviddotcs/safe-routing

Why I have not tested : later

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=SafeRouting,&body=https://github.com/daviddotcs/safe-routing


30) [SerdeDn]( https://github.com/serdedotnet/serde) , https://github.com/serdedotnet/serde
29) [SerdeDn]( https://github.com/serdedotnet/serde) , https://github.com/serdedotnet/serde

Why I have not tested : serializer. Done by MSFT with System.Text.Json

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=SerdeDn&body=https://github.com/serdedotnet/serde


31) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator
30) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator

Why I have not tested : swagger,need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ST.NSwag.ServerSourceGenerator&body=https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator


32) [StringLiteralGenerator]( https://github.com/ufcpp/StringLiteralGenerator) , https://github.com/ufcpp/StringLiteralGenerator
31) [StringLiteralGenerator]( https://github.com/ufcpp/StringLiteralGenerator) , https://github.com/ufcpp/StringLiteralGenerator

Why I have not tested : string 2 utf8

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=StringLiteralGenerator&body=https://github.com/ufcpp/StringLiteralGenerator


33) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/
32) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/

Why I have not tested : too complicated for me, need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=StrongInject&body=https://github.com/YairHalberstadt/stronginject/


34) [TeuJson]( https://github.com/Terria-K/TeuJson) , https://github.com/Terria-K/TeuJson
33) [TeuJson]( https://github.com/Terria-K/TeuJson) , https://github.com/Terria-K/TeuJson

Why I have not tested : json a class, was done in System.Text.Json

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TeuJson&body=https://github.com/Terria-K/TeuJson


35) [Tinyhand]( https://github.com/archi-Doc/Tinyhand) , https://github.com/archi-Doc/Tinyhand
34) [Tinyhand]( https://github.com/archi-Doc/Tinyhand) , https://github.com/archi-Doc/Tinyhand

Why I have not tested : tried, need documentation

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Tinyhand&body=https://github.com/archi-Doc/Tinyhand


36) [Tortuga.Shipwright]( https://github.com/TortugaResearch/Tortuga.Shipwright) , https://github.com/TortugaResearch/Tortuga.Shipwright
35) [Tortuga.Shipwright]( https://github.com/TortugaResearch/Tortuga.Shipwright) , https://github.com/TortugaResearch/Tortuga.Shipwright

Why I have not tested : too complicated for me, need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Tortuga.Shipwright&body=https://github.com/TortugaResearch/Tortuga.Shipwright


37) [TupleOverloadGenerator]( https://github.com/ProphetLamb/TupleOverloadGenerator) , https://github.com/ProphetLamb/TupleOverloadGenerator
36) [TupleOverloadGenerator]( https://github.com/ProphetLamb/TupleOverloadGenerator) , https://github.com/ProphetLamb/TupleOverloadGenerator

Why I have not tested : too complicated for me, need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TupleOverloadGenerator&body=https://github.com/ProphetLamb/TupleOverloadGenerator


38) [TypealizR]( https://github.com/earloc/TypealizR) , https://github.com/earloc/TypealizR
37) [TypealizR]( https://github.com/earloc/TypealizR) , https://github.com/earloc/TypealizR

Why I have not tested : depends on Microsoft.Extensions.Localization

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TypealizR&body=https://github.com/earloc/TypealizR


39) [ValueLink]( https://github.com/archi-Doc/ValueLink) , https://github.com/archi-Doc/ValueLink
38) [ValueLink]( https://github.com/archi-Doc/ValueLink) , https://github.com/archi-Doc/ValueLink

Why I have not tested : too complicated for me, need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ValueLink&body=https://github.com/archi-Doc/ValueLink


40) [Visor]( https://github.com/Tinkoff/Visor) , https://github.com/Tinkoff/Visor
39) [Visor]( https://github.com/Tinkoff/Visor) , https://github.com/Tinkoff/Visor

Why I have not tested : too complicated for me, need help

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Visor&body=https://github.com/Tinkoff/Visor


41) [WinUI-ObservableSettings]( https://github.com/JasonWei512/WinUI-ObservableSettings) , https://github.com/JasonWei512/WinUI-ObservableSettings
40) [WinUI-ObservableSettings]( https://github.com/JasonWei512/WinUI-ObservableSettings) , https://github.com/JasonWei512/WinUI-ObservableSettings

Why I have not tested : less than net 7

https://github.com/ignatandrei/RSCG_Examples/issues/new?title=WinUI-ObservableSettings&body=https://github.com/JasonWei512/WinUI-ObservableSettings


42) [WrapperValueObject]( https://github.com/martinothamar/WrapperValueObject) , https://github.com/martinothamar/WrapperValueObject
41) [WrapperValueObject]( https://github.com/martinothamar/WrapperValueObject) , https://github.com/martinothamar/WrapperValueObject

Why I have not tested : not maintained as in readme

Expand Down
4 changes: 2 additions & 2 deletions v2/Generator/MultiGeneratorV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public class MultiGeneratorV2
,new ("ValueObjectGenerator https://github.com/RyotaMurohoshi/ValueObjectGenerator",old)
,new ("Visor https://github.com/Tinkoff/Visor",tooComplicated)
,new("PolySharp https://github.com/Sergio0694/PolySharp",tooComplicated)
,new ("SafeRouting, https://github.com/daviddotcs/safe-routing",later)
,new ("Figgle, https://github.com/drewnoakes/figgle",old)
,new ("Protobuf Source Generator,https://github.com/ladeak/ProtobufSourceGenerator",later)
,new("Jos.Enumeration, https://github.com/joseftw/jos.enumeration",tooComplicated)
Expand Down Expand Up @@ -237,7 +236,8 @@ public MultiGeneratorV2(string root)
{"Roozie.AutoInterface",new GeneratorData(true,new(2023,8,26),Category.EnhancementClass) },
{"Memo",new GeneratorData(true,new(2023,8,27),Category.FunctionalProgramming) },
{"ThisAssembly_Resources", new GeneratorData(true,new(2023,9,16),Category.FilesToCode) },
{"SourceGenerator.Helper.CopyCode",new (true, new(2023,9,17), Category.EnhancementProject) }
{"SourceGenerator.Helper.CopyCode",new (true, new(2023,9,17), Category.EnhancementProject) },
{"SafeRouting",new(true,new(2023,09,23)) }
};

//foreach (var v in generators)
Expand Down
1 change: 1 addition & 0 deletions v2/Generator/all.csv
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ Nr,Key,Source,Category
57,Memo, https://github.com/ignatandrei/RSCG_Utils,FunctionalProgramming
58,ThisAssembly_Resources, https://github.com/devlooped/ThisAssembly,FilesToCode
59,SourceGenerator.Helper.CopyCode, https://github.com/LokiMidgard/SourceGenerator.Helper.CopyCode,EnhancementProject
60,SafeRouting, https://github.com/daviddotcs/safe-routing,None
99 changes: 99 additions & 0 deletions v2/book/examples/SafeRouting.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

<h1>RSCG nr 60 : SafeRouting</h1>

<h2>Info</h2>
Nuget : <a href="https://www.nuget.org/packages/SafeRouting/" target="_blank">https://www.nuget.org/packages/SafeRouting/</a>

<p>You can find more details at : <a href="https://github.com/daviddotcs/safe-routing" target="_blank"> https://github.com/daviddotcs/safe-routing</a></p>

<p>Author :David Wake</p>

<p>Source : <a href="https://github.com/daviddotcs/safe-routing" target="_blank">https://github.com/daviddotcs/safe-routing</a> </p>

<h2>About</h2>

Safe Routing for MVC

<h2>
How to use
</h2>
<h3>
Add reference to the <a href="https://www.nuget.org/packages/SafeRouting/" target="_blank">SafeRouting</a> in the csproj
</h3>
<img src="images/SafeRouting/SafeRoutingDemo.csproj.png" width="580" height="580" />

<h3>This was for me the <b>starting</b> code</h3>

<br />
I have <b>coded</b> the file _ViewImports.cshtml
<br />
<img src="images/SafeRouting/csFiles/_ViewImports.cshtml.png" width="580" height="580" />
<hr />

<br />
I have <b>coded</b> the file _Layout.cshtml
<br />
<img src="images/SafeRouting/csFiles/_Layout.cshtml.png" width="580" height="580" />
<hr />
<h3>And here are the <i>generated</i> files</h3>

<br />
The file <i>generated</i> is Views_Home_Index_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views_Home_Index_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views_Home_Privacy_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views_Home_Privacy_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views_Shared_Error_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views_Shared_Error_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views_Shared__Layout_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views_Shared__Layout_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views_Shared__ValidationScriptsPartial_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views_Shared__ValidationScriptsPartial_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views__ViewImports_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views__ViewImports_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is Views__ViewStart_cshtml.g.cs
<br />
<img src="images/SafeRouting/generated/Views__ViewStart_cshtml.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is ControllerRoutes.g.cs
<br />
<img src="images/SafeRouting/generated/ControllerRoutes.g.cs.png" width="580" height="580" />

<br />
The file <i>generated</i> is globalusings.g.cs
<br />
<img src="images/SafeRouting/generated/globalusings.g.cs.png" width="580" height="580" />

<p>
You can download the code and this page as pdf from
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/SafeRouting'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/SafeRouting
</a>
</p>


<p>
You can see the whole list at
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG
</a>
</p>

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions v2/book/examples/images/SafeRouting/SafeRoutingDemo.csproj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SafeRouting" Version="1.4.0" />
</ItemGroup>

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions v2/book/examples/images/SafeRouting/csFiles/_Layout.cshtml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@{
var privacy = Routes.Controllers.Home.Privacy();

}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - SafeRoutingDemo</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/SafeRoutingDemo.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">SafeRoutingDemo</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a for-route="privacy">!New Privacy!</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>

<footer class="border-top footer text-muted">
<div class="container">
&copy; 2023 - SafeRoutingDemo - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@using SafeRoutingDemo
@using SafeRoutingDemo.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper SafeRouting.TagHelpers.*, SafeRouting.Common
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b697ec8

Please sign in to comment.