-
-
Notifications
You must be signed in to change notification settings - Fork 6
Add DecoratorGenerator example with demo project #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ignatandrei
merged 3 commits into
main
from
420-httpsgithubcomcodingflowdecorator-generatorissues82issuecomment-3573571178
Nov 29, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
|
|
||
| { | ||
| "$schema": "https://aka.ms/codetour-schema", | ||
| "title": "DecoratorGenerator", | ||
| "steps": | ||
| [ | ||
| { | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj", | ||
| "description": "First, we add Nuget [DecoratorGenerator](https://www.nuget.org/packages/DecoratorGenerator/) in csproj ", | ||
| "pattern": "DecoratorGenerator" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs", | ||
| "description": "File LogPerson.cs ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs", | ||
| "description": "File IPerson.cs ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs", | ||
| "description": "File Person.cs ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
| ,{ | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/Program.cs", | ||
| "description": "File Program.cs \r\n>> dotnet run --project rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj ", | ||
| "pattern": "this is the code" | ||
| } | ||
|
|
||
|
|
||
| ,{ | ||
| "file": "rscg_examples/DecoratorGenerator/src/DecoratorDemo/obj/GX/DecoratorGenerator/DecoratorGenerator.Main/PersonDecorator.generated.cs", | ||
| "description": "Generated File 1 from 1 : PersonDecorator.generated.cs ", | ||
| "line": 1 | ||
| } | ||
|
|
||
| ], | ||
|
|
||
| "ref": "main" | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,5 +43,6 @@ public enum Category | |
| RX=38, | ||
| Mixin=39, | ||
| Validator=40, | ||
| Decorator= 41 | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
|
|
||
| <h1>RSCG nr 241 : DecoratorGenerator</h1> | ||
|
|
||
| <h2>Info</h2> | ||
| Nuget : <a href="https://www.nuget.org/packages/DecoratorGenerator/" target="_blank">https://www.nuget.org/packages/DecoratorGenerator/</a> | ||
|
|
||
| <p>You can find more details at : <a href="https://github.com/CodingFlow/decorator-generator" target="_blank"> https://github.com/CodingFlow/decorator-generator</a></p> | ||
|
|
||
| <p>Author :Leopoldo Fu</p> | ||
|
|
||
| <p>Source: <a href="https://github.com/CodingFlow/decorator-generator" target="_blank">https://github.com/CodingFlow/decorator-generator</a> </p> | ||
|
|
||
| <h2>About</h2> | ||
|
|
||
| adding decorator for classes/ interfaces | ||
|
|
||
| <h2> | ||
| How to use | ||
| </h2> | ||
| <h3> | ||
| Add reference to the <a href="https://www.nuget.org/packages/DecoratorGenerator/" target="_blank">DecoratorGenerator</a> in the csproj | ||
| </h3> | ||
| <img src="images/DecoratorGenerator/DecoratorDemo.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/DecoratorGenerator/csFiles/Program.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file Person.cs | ||
| <br /> | ||
| <img src="images/DecoratorGenerator/csFiles/Person.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file IPerson.cs | ||
| <br /> | ||
| <img src="images/DecoratorGenerator/csFiles/IPerson.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file LogPerson.cs | ||
| <br /> | ||
| <img src="images/DecoratorGenerator/csFiles/LogPerson.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
| <h3>And here are the <i>generated</i> files</h3> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is PersonDecorator.generated.cs | ||
| <br /> | ||
| <img src="images/DecoratorGenerator/generated/PersonDecorator.generated.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/DecoratorGenerator'> | ||
| https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator | ||
| </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> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "generator":{ | ||
| "name":"DecoratorGenerator", | ||
| "nuget":[ | ||
| "https://www.nuget.org/packages/DecoratorGenerator/" | ||
| ], | ||
| "link":"https://github.com/CodingFlow/decorator-generator", | ||
| "author":"Leopoldo Fu", | ||
| "source":"https://github.com/CodingFlow/decorator-generator" | ||
| }, | ||
| "data":{ | ||
| "goodFor":["adding decorator for classes/ interfaces"], | ||
| "csprojDemo":"DecoratorDemo.csproj", | ||
| "csFiles":["Program.cs","Person.cs","IPerson.cs","LogPerson.cs"], | ||
| "excludeDirectoryGenerated":[""], | ||
| "includeAdditionalFiles":[""] | ||
| }, | ||
| "links":{ | ||
| "blog":"", | ||
| "video":"" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Source generator for decorator pattern boilerplate code in C#. | ||
|
|
||
| When implementing the decorator pattern in C#, it requires adding boilerplate code for every interface that needs to support decorators, namely the abstract class. Boilerplate is tedious to write and error-prone. This source generator solves this problem by automatically generating the abstract class. It only needs to be told which interfaces it should generate the abstract class for. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ignatandrei/RSCG_Examples
Length of output: 253
Documentation link is broken (404) — needs correction before merge.
Verification results:
The documentation URL
https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGeneratorreturns a 404 error. This link should be removed or corrected to point to a valid documentation page before merging.🤖 Prompt for AI Agents