Skip to content
Merged

first #505

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# RSCG - 270 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
# RSCG - 271 Examples of Roslyn Source Code Generators / 16 created by Microsoft /

The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 270 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.
The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 271 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.

This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem

## Latest Update : 2026-05-15 => 15 May 2026
## Latest Update : 2026-05-16 => 16 May 2026

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 @@ -24,8 +24,30 @@ If you want to be notified each time I add a new RSCG example , please click htt

## Content

Those are the 270 Roslyn Source Code Generators that I have tested you can see and download source code example.
Those are the 271 Roslyn Source Code Generators that I have tested you can see and download source code example.
( including 16 from Microsoft )
### 271. [TypedStateBuilder.Generator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/TypedStateBuilder.Generator) , in the [Builder](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#builder) category

Generated on : 2026-05-16 => 16 May 2026

<details>
<summary>Expand</summary>



Author: Georgiy Petrov

A Roslyn source generator that produces **compile-time safe builders** using the *type-state pattern*.

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


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

Source: [https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator](https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator)

</details>

### 270. [AssemblyMetadata.Generators](https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category

Generated on : 2026-05-15 => 15 May 2026
Expand Down
2 changes: 1 addition & 1 deletion later.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Just later

## Latest Update : 2026-05-15 => 15 May 2026
## Latest Update : 2026-05-16 => 16 May 2026



Expand Down
42 changes: 42 additions & 0 deletions v2/.tours/TypedStateBuilder.Generator.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

{
"$schema": "https://aka.ms/codetour-schema",
"title": "TypedStateBuilder.Generator",
"steps":
[
{
"file": "rscg_examples/TypedStateBuilder.Generator/src/Builder/Builder.csproj",
"description": "First, we add Nuget [TypedStateBuilder.Generator](https://www.nuget.org/packages/TypedStateBuilder.Generator/) in csproj ",
"pattern": "TypedStateBuilder.Generator"
}

,{
"file": "rscg_examples/TypedStateBuilder.Generator/src/Builder/Person.cs",
"description": "File Person.cs ",
"pattern": "this is the code"
}

,{
"file": "rscg_examples/TypedStateBuilder.Generator/src/Builder/Program.cs",
"description": "File Program.cs \r\n>> dotnet run --project rscg_examples/TypedStateBuilder.Generator/src/Builder/Builder.csproj ",
"pattern": "this is the code"
}


,{
"file": "rscg_examples/TypedStateBuilder.Generator/src/Builder/obj/GX/TypedStateBuilder.Generator/TypedStateBuilder.Generator.TypedStateBuilderIncrementalGenerator/TypedStateBuilder.Attributes.g.cs",
"description": "Generated File 2 from 2 : TypedStateBuilder.Attributes.g.cs ",
"line": 1
}

,{
"file": "rscg_examples/TypedStateBuilder.Generator/src/Builder/obj/GX/TypedStateBuilder.Generator/TypedStateBuilder.Generator.TypedStateBuilderIncrementalGenerator/global__Builder_PersonBuilder_7DB9C28B.TypedStateBuilder.g.cs",
"description": "Generated File 1 from 2 : global__Builder_PersonBuilder_7DB9C28B.TypedStateBuilder.g.cs ",
"line": 1
}

],

"ref": "main"

}
1 change: 1 addition & 0 deletions v2/Generator/all.csv
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,4 @@ Nr,Key,Source,Category
268,GenerateDispose, https://github.com/ItaiTzur76/GenerateDispose,Disposer
269,LinkDotNet.Enumeration, https://github.com/linkdotnet/Enumeration,Enum
270,AssemblyMetadata.Generators, https://github.com/loresoft/AssemblyMetadata.Generators,EnhancementProject
271,TypedStateBuilder.Generator, https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator,Builder
6 changes: 6 additions & 0 deletions v2/RSCGExamplesData/GeneratorDataRec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1637,4 +1637,10 @@
"dtStart": "2026-05-15T00:00:00",
"show": true
},
{
"ID":"TypedStateBuilder.Generator",
"Category": 4,
"dtStart": "2026-05-16T00:00:00",
"show": true
}
]
64 changes: 64 additions & 0 deletions v2/book/examples/TypedStateBuilder.Generator.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

<h1>RSCG nr 271 : TypedStateBuilder.Generator</h1>

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

<p>You can find more details at : <a href="https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator" target="_blank"> https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator</a></p>

<p>Author :Georgiy Petrov</p>

<p>Source: <a href="https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator" target="_blank">https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator</a> </p>

<h2>About</h2>

Generate strongly typed state builders for C# applications, improving code readability and maintainability.

<h2>
How to use
</h2>
<h3>
Add reference to the <a href="https://www.nuget.org/packages/TypedStateBuilder.Generator/" target="_blank">TypedStateBuilder.Generator</a> in the csproj
</h3>
<img src="images/TypedStateBuilder.Generator/Builder.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 Program.cs
<br />
<img src="images/TypedStateBuilder.Generator/csFiles/Program.cs.png" width="580" height="580" />
<hr />

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

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

<br />
The file <i>generated</i> is TypedStateBuilder.Attributes.g.cs
<br />
<img src="images/TypedStateBuilder.Generator/generated/TypedStateBuilder.Attributes.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/TypedStateBuilder.Generator'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/TypedStateBuilder.Generator
</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>

6 changes: 5 additions & 1 deletion v2/book/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>
<h1>
This is the list of 270 RSCG with examples =>
This is the list of 271 RSCG with examples =>
</h1>

<table >
Expand Down Expand Up @@ -1106,6 +1106,10 @@ <h1>
<td>270</td>
<td><a href="examples/AssemblyMetadata.Generators.html">AssemblyMetadata.Generators</a></td>
</tr>
<tr>
<td>271</td>
<td><a href="examples/TypedStateBuilder.Generator.html">TypedStateBuilder.Generator</a></td>
</tr>
</table>


Expand Down
1 change: 1 addition & 0 deletions v2/book/pandocHTML.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ input-files:
- examples/GenerateDispose.html
- examples/LinkDotNet.Enumeration.html
- examples/AssemblyMetadata.Generators.html
- examples/TypedStateBuilder.Generator.html

# or you may use input-file: with a single value
# defaults:
Expand Down
6 changes: 6 additions & 0 deletions v2/docFind.json
Original file line number Diff line number Diff line change
Expand Up @@ -1618,5 +1618,11 @@
"category": "EnhancementProject",
"href": "/RSCG_Examples/v2/docs/AssemblyMetadata.Generators/",
"body": "Source generator to expose assembly attributes as string constants"
},
{
"title": "TypedStateBuilder.Generator",
"category": "Builder",
"href": "/RSCG_Examples/v2/docs/TypedStateBuilder.Generator/",
"body": "A Roslyn source generator that produces **compile-time safe builders** using the *type-state pattern*."
}
]
67 changes: 67 additions & 0 deletions v2/rscg_examples/TypedStateBuilder.Generator/description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"generator":{
"name":"TypedStateBuilder.Generator",
"nuget":[
"https://www.nuget.org/packages/TypedStateBuilder.Generator/"
],
"link":"https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator",
"author":"Georgiy Petrov",
"source":"https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator"
},
"data":{
"goodFor":["Generate strongly typed state builders for C# applications, enforced at compile time",
"**Summary of TypedStateBuilder.Generator**",
"",
"**Purpose:** Generates compile-time safe step-by-step builders using the *type-state pattern* — each required property must be set in order before Build() is available, enforced at compile time.",
"",
"**NuGet:** https://www.nuget.org/packages/TypedStateBuilder.Generator/",
"**GitHub:** https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator",
"**Author:** Georgiy Petrov",
"",
"**How to use:**",
"",
"1. Decorate a builder class with [TypedStateBuilder], mark each required step with [StepForValue], and optionally add [ValidateValue] for validation:",
"```csharp",
"[TypedStateBuilder]",
"public class PersonBuilder",
"{",
" [StepForValue]",
" [ValidateValue(nameof(ValidateName))]",
" private string lastName = string.Empty;",
"",
" [StepForValue]",
" [ValidateValue(nameof(ValidateName))]",
" private string firstName = string.Empty;",
"",
" public void ValidateName(string name)",
" {",
" if (string.IsNullOrWhiteSpace(name) || name.Length <= 1)",
" throw new ArgumentException(\"Name must be at least 2 characters long.\");",
" }",
"",
" [Build]",
" public Person Build() => new Person(firstName, lastName);",
"}",
"```",
"",
"2. Use the generated fluent builder — steps are enforced in order at compile time:",
"```csharp",
"var p = TypedStateBuilders",
" .CreatePersonBuilder()",
" .SetFirstName(\"Andrei\")",
" .SetLastName(\"Ignat\")",
" .Build();",
"",
"Console.WriteLine(p.FullName()); // \"Andrei Ignat\"",
"```",
""],
"csprojDemo":"Builder.csproj",
"csFiles":["Program.cs","Person.cs"],
"excludeDirectoryGenerated":[""],
"includeAdditionalFiles":[""]
},
"links":{
"blog":"",
"video":""
}
}
1 change: 1 addition & 0 deletions v2/rscg_examples/TypedStateBuilder.Generator/nuget.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A Roslyn source generator that produces **compile-time safe builders** using the *type-state pattern*.
Loading
Loading