Skip to content

first#502

Merged
ignatandrei merged 6 commits into
mainfrom
496-httpsgithubcomlinkdotnetenumeration
May 27, 2026
Merged

first#502
ignatandrei merged 6 commits into
mainfrom
496-httpsgithubcomlinkdotnetenumeration

Conversation

@ignatandrei
Copy link
Copy Markdown
Owner

@ignatandrei ignatandrei commented May 27, 2026

Summary by CodeRabbit

  • New Features

    • Added LinkDotNet.Enumeration as the 269th RSCG example, including a runnable demo and example usage for string-based enumerations.
  • Documentation

    • Added comprehensive LinkDotNet.Enumeration documentation, examples, and walkthroughs.
    • Expanded GenerateDispose documentation with detailed usage guidance and examples.
  • Site Updates

    • Updated site listings, indexes, and badges to reflect 269 total examples.

Review Change Stack

Copilot AI review requested due to automatic review settings May 27, 2026 03:59
@ignatandrei ignatandrei linked an issue May 27, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e0d47bb-08c3-44cc-84ac-9f1012a19fe2

📥 Commits

Reviewing files that changed from the base of the PR and between fa1c570 and 3accacc.

⛔ Files ignored due to path filters (1)
  • v2/rscg_examples_site/static/exports/RSCG.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (6)
  • v2/rscg_examples/GenerateDispose/description.json
  • v2/rscg_examples/GenerateDispose/video.json
  • v2/rscg_examples/LinkDotNet.Enumeration/description.json
  • v2/rscg_examples/LinkDotNet.Enumeration/video.json
  • v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md
  • v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md
✅ Files skipped from review due to trivial changes (3)
  • v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md
  • v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md
  • v2/rscg_examples/GenerateDispose/video.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • v2/rscg_examples/GenerateDispose/description.json
  • v2/rscg_examples/LinkDotNet.Enumeration/video.json
  • v2/rscg_examples/LinkDotNet.Enumeration/description.json

📝 Walkthrough

Walkthrough

This PR adds LinkDotNet.Enumeration as the 269th RSCG example, integrating it into the generator catalog through core data records, a complete working example with demo project, user documentation pages, and updated listing surfaces across README, navigation pages, and category indexes. A secondary enhancement expands GenerateDispose documentation with detailed usage guidance.

Changes

LinkDotNet.Enumeration Example Addition

Layer / File(s) Summary
Core generator data records
v2/RSCGExamplesData/GeneratorDataRec.json, v2/rscg_examples_site/static/exports/RSCG.json, v2/docFind.json, v2/book/pandocHTML.yaml, later.md
New LinkDotNet.Enumeration indexed generator record added to catalog data files with metadata (category 19, date 2026-05-14, enabled state) and integrated into documentation discovery/build configuration.
LinkDotNet.Enumeration example implementation
v2/rscg_examples/LinkDotNet.Enumeration/description.json, nuget.txt, readme.txt, src/EnumDemo/CarTypes.cs, src/EnumDemo/EnumDemo.csproj, src/EnumDemo/Program.cs, src/.tours/LinkDotNet.Enumeration.tour, src/EnumDemo.sln, video.json
Complete example implementation including generator metadata, usage documentation, demo C# project targeting net10.0, CarTypes enumeration definition using Enumeration attribute, console program demonstrating pattern matching and parsing APIs, CodeTour for interactive exploration, and video script for demonstration.
LinkDotNet.Enumeration documentation
v2/book/examples/LinkDotNet.Enumeration.html, v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md
User-facing documentation including HTML reference page with package links and usage sections, and comprehensive MDX documentation with NuGet/GitHub badges, original README content, code examples, generated-file snippets, and utility links.
Catalog listing page updates
README.md, v2/book/list.html, v2/rscg_examples_site/docs/RSCG-Examples/index.md, v2/rscg_examples_site/docs/indexRSCG.md, v2/rscg_examples_site/docs/about.md, v2/rscg_examples_site/src/components/HomepageFeatures/index.js
Updated example count from 268 to 269 across all public-facing list headers, frontmatter descriptions, list table entries, and component titles. Mermaid flowchart and category accordion counters updated to reflect new Enum entry.
Category and author metadata
v2/rscg_examples_site/docs/Categories/Enum.md, v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx, v2/rscg_examples_site/docs/Authors/Steven_Giesel.md
Enum category pages inserted LinkDotNet.Enumeration into the ranked list and renumbered subsequent entries; author page updated to include the new package badge and incremented count.

GenerateDispose Documentation Enhancement

Layer / File(s) Summary
GenerateDispose documentation expansion
v2/rscg_examples/GenerateDispose/description.json, v2/rscg_examples/GenerateDispose/video.json, v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md
Replaced minimal placeholder content with comprehensive documentation covering purpose, attribute syntax, generated member structure (Dispose overloads, disposal guard, sealed/non-sealed adaptation), usage patterns, and key benefits.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A new enumeration hops into the fold,
Two hundred sixty-nine tales now told,
Strings and matches stitched just right,
GenerateDispose gained clearer light.
Hooray — the catalog grows overnight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'first' is vague and generic, providing no meaningful information about the changeset, which adds LinkDotNet.Enumeration example #269 with comprehensive documentation and demo files. Use a descriptive title such as 'Add LinkDotNet.Enumeration RSCG example #269' to clearly convey the primary change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 496-httpsgithubcomlinkdotnetenumeration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new RSCG example for LinkDotNet.Enumeration (incl. demo project + docs/site/book integration) and upgrades GenerateDispose metadata to the newer “## Summary …” format, while bumping repository/site counts from 268 → 269.

Changes:

  • Added a new example package folder and demo project for LinkDotNet.Enumeration (source, tour, video script, metadata).
  • Generated and integrated new documentation pages/exports (site docs, category/author indexes, search index, book HTML list/pages).
  • Updated GenerateDispose’s description/video metadata to the expanded summary format and updated global counts/latest dates.

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v2/RSCGExamplesData/GeneratorDataRec.json Registers the new generator entry (LinkDotNet.Enumeration) in the data feed.
v2/rscg_examples/LinkDotNet.Enumeration/video.json Adds the video script steps for the new example.
v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/Program.cs New demo console app showing parsing + exhaustive Match(...).
v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/EnumDemo.csproj New demo project referencing the generator package.
v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/CarTypes.cs Defines the [Enumeration(...)] sample type used by the demo.
v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo.sln Solution file for the demo project.
v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour VS Code CodeTour steps for the new example.
v2/rscg_examples/LinkDotNet.Enumeration/readme.txt Captures upstream/readme content for the generator.
v2/rscg_examples/LinkDotNet.Enumeration/nuget.txt Short NuGet description snippet for the generator.
v2/rscg_examples/LinkDotNet.Enumeration/description.json Generator metadata and “goodFor” summary used for docs generation.
v2/rscg_examples/GenerateDispose/video.json Updates the video script summary text for GenerateDispose.
v2/rscg_examples/GenerateDispose/description.json Expands GenerateDispose “goodFor” content to the multi-section summary format.
v2/rscg_examples_site/static/exports/RSCG.json Adds LinkDotNet.Enumeration to the exported JSON dataset.
v2/rscg_examples_site/src/components/HomepageFeatures/index.js Updates homepage example count from 268 to 269.
v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md Adds the full docs page for the new generator example.
v2/rscg_examples_site/docs/RSCG-Examples/index.md Updates list counts and adds LinkDotNet.Enumeration to Enum category listings/diagram.
v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md Updates page frontmatter + “About” section to the summary format.
v2/rscg_examples_site/docs/indexRSCG.md Updates global list count and adds the new entry to the chronological index.
v2/rscg_examples_site/docs/Categories/Enum.md Updates Enum category count and inserts LinkDotNet.Enumeration.
v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx Updates “SameCategory” content to include the new Enum example.
v2/rscg_examples_site/docs/Authors/Steven_Giesel.md Updates author page count and adds LinkDotNet.Enumeration to the author list.
v2/rscg_examples_site/docs/about.md Updates the overall RSCG count to 269.
v2/docFind.json Adds LinkDotNet.Enumeration to the search/find index.
v2/book/pandocHTML.yaml Adds LinkDotNet.Enumeration book HTML input entry.
v2/book/list.html Updates book list count and adds LinkDotNet.Enumeration to the table.
v2/book/examples/LinkDotNet.Enumeration.html Adds the book HTML page for the new example.
README.md Updates repo-wide counts/latest update and adds LinkDotNet.Enumeration entry.
later.md Updates the “Latest Update” date to 2026-05-14.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public sealed partial record Color;
```

This will generate a `JsonConverter` that can be used with `System.Text.Json` to serialize and deserialize `Color` instances as their string keys. The generated converter is called `\{TypeName}\}JsonConverter`.
public Casing MemberCasing \{ get; }
/// <summary>
/// When <see langword="true"/>, a <see cref="System.Text.Json.Serialization.JsonConverterAttribute"/>
/// is applied to the enumeration type and a <c>\{TypeName}\}JsonConverter</c> class is generated
Comment on lines +2 to +3
using EnumDemo;
using System.Reflection;
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (3)
v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour (2)

19-23: 💤 Low value

Replace placeholder pattern with actual code pattern.

The pattern "this is the code" appears to be a placeholder. Consider using an actual code pattern from Program.cs (e.g., "CarTypes.TryParse") or removing the pattern field to highlight the entire file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour`
around lines 19 - 23, The tour file contains a placeholder pattern "this is the
code" for the entry referencing EnumDemo/Program.cs; replace that placeholder
with a real code pattern from Program.cs (for example "CarTypes.TryParse" or
another specific snippet present in the file) or remove the "pattern" field
entirely so the tour highlights the full file; update the JSON entry that
currently references "EnumDemo/Program.cs" to use the real symbol or omit the
pattern.

14-17: 💤 Low value

Replace placeholder pattern with actual code pattern.

The pattern "this is the code" appears to be a placeholder. Consider using an actual code pattern from CarTypes.cs (e.g., "Enumeration") or removing the pattern field to highlight the entire file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour`
around lines 14 - 17, The tour entry references EnumDemo/CarTypes.cs but uses a
placeholder pattern "this is the code"; update the "pattern" value to a real
code snippet or identifier found in CarTypes.cs (for example a class or enum
name like "CarTypes" or "Enumeration") or remove the "pattern" field entirely so
the tour highlights the whole file, ensuring the tour matches actual content in
CarTypes.cs.
v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/Program.cs (1)

3-3: ⚡ Quick win

Remove unused import.

The System.Reflection namespace is imported but never used in this file.

🧹 Proposed fix
-using System.Reflection;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/Program.cs` at line 3,
Remove the unused using directive "using System.Reflection;" from Program.cs
(it's not referenced by the Program class or any methods), leaving only the
required using statements; verify the file still compiles and run a quick build
to ensure no dependent reflection APIs were accidentally removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@v2/book/list.html`:
- Line 20: Replace the literal ">" character in the HTML content string "This is
the list of 269 RSCG with examples =>" with its HTML-escaped entity "&gt;";
update the text in v2/book/list.html so the line reads "This is the list of 269
RSCG with examples =&gt;" to prevent rendering/parsing issues.

In `@v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md`:
- Around line 166-295: The GenerateDispose documentation is fragmented by
excessive blank lines and indented code causing broken markdown; update the
source by first refactoring the goodFor array in description.json into a concise
summary, then rewrite RSCG-Examples/GenerateDispose.md to use continuous
paragraphs, properly fenced code blocks (```), and remove superfluous blank
lines so the example partial class DALDB, attribute
[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))], the Dispose
pattern description (public Dispose(), private int _isDisposed, sealed vs
non-sealed behavior) and usage examples appear as coherent sections with correct
Markdown headings and no indented code blocks.
- Line 4: The frontmatter "description" currently contains Markdown heading
syntax ("## Summary: GenerateDispose") which makes it invalid; replace that
value with plain text (e.g., "Summary: GenerateDispose" or "GenerateDispose
summary") so the description is a simple string and not null, ensuring the
frontmatter description field is a plain-text string without Markdown
characters.

In `@v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md`:
- Line 4: Replace the front matter description value that currently contains
markdown ("## Summary: LinkDotNet.Enumeration") with a plain string; update the
description field in the document's YAML front matter (the "description" key) to
a simple text value such as "Summary: LinkDotNet.Enumeration" or just
"LinkDotNet.Enumeration" so it no longer contains markdown heading syntax.

In `@v2/rscg_examples/GenerateDispose/description.json`:
- Around line 12-55: The goodFor metadata array currently contains full tutorial
Markdown and code blocks; replace the entire goodFor array content with a
concise 1–3 sentence summary for the GenerateDispose generator (e.g., "Generates
a thread-safe Dispose implementation from a named cleanup method, adapting for
sealed/non-sealed classes"), and move the long-form examples and multi-section
tutorial into the generator's MDX documentation (About section) so formatting
and code blocks render correctly; ensure any consumers (e.g., the video template
that joins GoodFor) now receive the short summary only.

In `@v2/rscg_examples/LinkDotNet.Enumeration/video.json`:
- Around line 35-36: In video.json there is a JSON syntax error: the property
SpeakTest is written as SpeakTest=" " instead of a proper JSON key/value pair;
update the object that contains "typeStep" and "arg" so the SpeakTest property
is quoted and uses a colon (i.e. "SpeakTest": " "), ensuring commas and
surrounding braces remain valid for the array/object in
v2/rscg_examples/LinkDotNet.Enumeration/video.json.

---

Nitpick comments:
In
`@v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour`:
- Around line 19-23: The tour file contains a placeholder pattern "this is the
code" for the entry referencing EnumDemo/Program.cs; replace that placeholder
with a real code pattern from Program.cs (for example "CarTypes.TryParse" or
another specific snippet present in the file) or remove the "pattern" field
entirely so the tour highlights the full file; update the JSON entry that
currently references "EnumDemo/Program.cs" to use the real symbol or omit the
pattern.
- Around line 14-17: The tour entry references EnumDemo/CarTypes.cs but uses a
placeholder pattern "this is the code"; update the "pattern" value to a real
code snippet or identifier found in CarTypes.cs (for example a class or enum
name like "CarTypes" or "Enumeration") or remove the "pattern" field entirely so
the tour highlights the whole file, ensuring the tour matches actual content in
CarTypes.cs.

In `@v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/Program.cs`:
- Line 3: Remove the unused using directive "using System.Reflection;" from
Program.cs (it's not referenced by the Program class or any methods), leaving
only the required using statements; verify the file still compiles and run a
quick build to ensure no dependent reflection APIs were accidentally removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9984084d-1577-407c-9c92-8ecbfa08cc43

📥 Commits

Reviewing files that changed from the base of the PR and between 2d39730 and fa1c570.

⛔ Files ignored due to path filters (2)
  • v2/rscg_examples_site/static/exports/RSCG.xlsx is excluded by !**/*.xlsx
  • v2/rscg_examples_site/static/sources/LinkDotNet.Enumeration.zip is excluded by !**/*.zip
📒 Files selected for processing (28)
  • README.md
  • later.md
  • v2/RSCGExamplesData/GeneratorDataRec.json
  • v2/book/examples/LinkDotNet.Enumeration.html
  • v2/book/list.html
  • v2/book/pandocHTML.yaml
  • v2/docFind.json
  • v2/rscg_examples/GenerateDispose/description.json
  • v2/rscg_examples/GenerateDispose/video.json
  • v2/rscg_examples/LinkDotNet.Enumeration/description.json
  • v2/rscg_examples/LinkDotNet.Enumeration/nuget.txt
  • v2/rscg_examples/LinkDotNet.Enumeration/readme.txt
  • v2/rscg_examples/LinkDotNet.Enumeration/src/.tours/LinkDotNet.Enumeration.tour
  • v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo.sln
  • v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/CarTypes.cs
  • v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/EnumDemo.csproj
  • v2/rscg_examples/LinkDotNet.Enumeration/src/EnumDemo/Program.cs
  • v2/rscg_examples/LinkDotNet.Enumeration/video.json
  • v2/rscg_examples_site/docs/Authors/Steven_Giesel.md
  • v2/rscg_examples_site/docs/Categories/Enum.md
  • v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx
  • v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md
  • v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md
  • v2/rscg_examples_site/docs/RSCG-Examples/index.md
  • v2/rscg_examples_site/docs/about.md
  • v2/rscg_examples_site/docs/indexRSCG.md
  • v2/rscg_examples_site/src/components/HomepageFeatures/index.js
  • v2/rscg_examples_site/static/exports/RSCG.json

Comment thread v2/book/list.html
<body>
<h1>
This is the list of 268 RSCG with examples =>
This is the list of 269 RSCG with examples =>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Escape the special character in HTML.

The > character should be escaped as &gt; in HTML content.

🔧 Proposed fix
-This is the list of 269 RSCG with examples =>
+This is the list of 269 RSCG with examples &gt;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This is the list of 269 RSCG with examples =>
This is the list of 269 RSCG with examples =&gt;
🧰 Tools
🪛 HTMLHint (1.9.2)

[error] 20-20: Special characters must be escaped : [ > ].

(spec-char-escape)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/book/list.html` at line 20, Replace the literal ">" character in the HTML
content string "This is the list of 269 RSCG with examples =>" with its
HTML-escaped entity "&gt;"; update the text in v2/book/list.html so the line
reads "This is the list of 269 RSCG with examples =&gt;" to prevent
rendering/parsing issues.

Comment thread v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md Outdated
Comment on lines +166 to +295
## Summary: GenerateDispose


### Purpose


A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.


It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).





### How to Define


[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]


partial class DALDB : IDisposable // : IDisposable is optional!


{


private ConnectionDB cn;


private ConnectionDB cn1;





public DALDB()


{


cn = new ConnectionDB();


cn1 = new ConnectionDB();


}





public void Drop() // Your custom disposal logic


{


cn.Dispose();


cn1.Dispose();


}


}





- The class must be partial


- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments





### What Gets Generated


- public void Dispose() (thread-safe, calls your method)


- A private int _isDisposed field for double-dispose protection


- Adapts to sealed vs non-sealed automatically (private vs protected virtual)





### How to Use


using (var db = new DALDB())


{


// use db...


} // Dispose() called automatically





### Key Benefits


- 10+ lines of boilerplate replaced by 1 attribute


- sealed changes auto-adapt the Dispose pattern


- No manual IDisposable wiring needed



Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Documentation section has excessive whitespace and formatting issues.

The expanded content (130 lines) renders each goodFor array element as a separate line, creating:

  • Excessive blank lines (e.g., lines 167-169, 177-180, 197-201)
  • Broken code block formatting flagged by markdownlint at lines 193 and 274 (indented instead of fenced)
  • Poor readability due to fragmented layout

This is a consequence of the goodFor array structure in description.json. Once that file is refactored to a concise summary, this section should be manually rewritten with proper Markdown formatting: continuous paragraphs, properly fenced code blocks, and appropriate whitespace.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 193-193: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


[warning] 274-274: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples_site/docs/RSCG-Examples/GenerateDispose.md` around lines 166
- 295, The GenerateDispose documentation is fragmented by excessive blank lines
and indented code causing broken markdown; update the source by first
refactoring the goodFor array in description.json into a concise summary, then
rewrite RSCG-Examples/GenerateDispose.md to use continuous paragraphs, properly
fenced code blocks (```), and remove superfluous blank lines so the example
partial class DALDB, attribute
[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))], the Dispose
pattern description (public Dispose(), private int _isDisposed, sealed vs
non-sealed behavior) and usage examples appear as coherent sections with correct
Markdown headings and no indented code blocks.

Comment thread v2/rscg_examples_site/docs/RSCG-Examples/LinkDotNet.Enumeration.md Outdated
Comment on lines +12 to +55
"goodFor":["## Summary: GenerateDispose",
"### Purpose",
"A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.",
"It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).",
"",
"### How to Define",
"[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]",
"partial class DALDB : IDisposable // : IDisposable is optional!",
"{",
" private ConnectionDB cn;",
" private ConnectionDB cn1;",
"",
" public DALDB()",
" {",
" cn = new ConnectionDB();",
" cn1 = new ConnectionDB();",
" }",
"",
" public void Drop() // Your custom disposal logic",
" {",
" cn.Dispose();",
" cn1.Dispose();",
" }",
"}",
"",
"- The class must be partial",
"- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments",
"",
"### What Gets Generated",
"- public void Dispose() (thread-safe, calls your method)",
"- A private int _isDisposed field for double-dispose protection",
"- Adapts to sealed vs non-sealed automatically (private vs protected virtual)",
"",
"### How to Use",
"using (var db = new DALDB())",
"{",
" // use db...",
"} // Dispose() called automatically",
"",
"### Key Benefits",
"- 10+ lines of boilerplate replaced by 1 attribute",
"- sealed changes auto-adapt the Dispose pattern",
"- No manual IDisposable wiring needed",
""],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

The goodFor array contains excessive Markdown formatting unsuitable for metadata.

The goodFor field has been expanded to include 44 lines of detailed Markdown content with code blocks, headings, and multi-line examples. This creates several downstream issues:

  1. Video script rendering (see video.json line 11): The build template joins this array with @string.Join("", Model.Data!.GoodFor!), producing an unreadable 1000+ character single-line narration string.

  2. Documentation rendering (see GenerateDispose.md lines 166-295): Each array element becomes a separate line, breaking code block formatting and creating excessive whitespace.

  3. Metadata field misuse: The goodFor field should contain a concise summary, not full tutorial content.

Recommendation: Replace this with a brief 1-3 sentence summary. Move the detailed examples, code snippets, and multi-section tutorial content directly into the MDX documentation file where formatting can be controlled properly.

♻️ Proposed refactoring
-      "goodFor":["## Summary: GenerateDispose",
-"### Purpose",
-"A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.",
-"It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).",
-"",
-"### How to Define",
-"[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]",
-"partial class DALDB : IDisposable   // : IDisposable is optional!",
-"{",
-"    private ConnectionDB cn;",
-"    private ConnectionDB cn1;",
-"",
-"    public DALDB()",
-"    {",
-"        cn = new ConnectionDB();",
-"        cn1 = new ConnectionDB();",
-"    }",
-"",
-"    public void Drop()   // Your custom disposal logic",
-"    {",
-"        cn.Dispose();",
-"        cn1.Dispose();",
-"    }",
-"}",
-"",
-"- The class must be partial",
-"- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments",
-"",
-"### What Gets Generated",
-"- public void Dispose() (thread-safe, calls your method)",
-"- A private int _isDisposed field for double-dispose protection",
-"- Adapts to sealed vs non-sealed automatically (private vs protected virtual)",
-"",
-"### How to Use",
-"using (var db = new DALDB())",
-"{",
-"    // use db...",
-"}  // Dispose() called automatically",
-"",
-"### Key Benefits",
-"- 10+ lines of boilerplate replaced by 1 attribute",
-"- sealed changes auto-adapt the Dispose pattern",
-"- No manual IDisposable wiring needed",
-""],
+      "goodFor":["Replaces 10+ lines of IDisposable boilerplate with a single attribute. Automatically adapts the Dispose pattern when class modifiers change (sealed/non-sealed)."],

Then add the detailed tutorial content directly in the MDX file's "About" section with proper Markdown formatting.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"goodFor":["## Summary: GenerateDispose",
"### Purpose",
"A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.",
"It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).",
"",
"### How to Define",
"[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]",
"partial class DALDB : IDisposable // : IDisposable is optional!",
"{",
" private ConnectionDB cn;",
" private ConnectionDB cn1;",
"",
" public DALDB()",
" {",
" cn = new ConnectionDB();",
" cn1 = new ConnectionDB();",
" }",
"",
" public void Drop() // Your custom disposal logic",
" {",
" cn.Dispose();",
" cn1.Dispose();",
" }",
"}",
"",
"- The class must be partial",
"- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments",
"",
"### What Gets Generated",
"- public void Dispose() (thread-safe, calls your method)",
"- A private int _isDisposed field for double-dispose protection",
"- Adapts to sealed vs non-sealed automatically (private vs protected virtual)",
"",
"### How to Use",
"using (var db = new DALDB())",
"{",
" // use db...",
"} // Dispose() called automatically",
"",
"### Key Benefits",
"- 10+ lines of boilerplate replaced by 1 attribute",
"- sealed changes auto-adapt the Dispose pattern",
"- No manual IDisposable wiring needed",
""],
"goodFor":["Replaces 10+ lines of IDisposable boilerplate with a single attribute. Automatically adapts the Dispose pattern when class modifiers change (sealed/non-sealed)."],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/GenerateDispose/description.json` around lines 12 - 55, The
goodFor metadata array currently contains full tutorial Markdown and code
blocks; replace the entire goodFor array content with a concise 1–3 sentence
summary for the GenerateDispose generator (e.g., "Generates a thread-safe
Dispose implementation from a named cleanup method, adapting for
sealed/non-sealed classes"), and move the long-form examples and multi-section
tutorial into the generator's MDX documentation (About section) so formatting
and code blocks render correctly; ensure any consumers (e.g., the video template
that joins GoodFor) now receive the short summary only.

Comment on lines +35 to +36
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration#download-example-net--c-",
SpeakTest=" "},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix JSON syntax error.

Line 36 contains invalid JSON syntax. The property key must be quoted and separated from its value with a colon.

🔧 Proposed fix
 {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration#download-example-net--c-",
-SpeakTest=" "},
+"SpeakTest": " "},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration#download-example-net--c-",
"SpeakTest": " "},
🧰 Tools
🪛 Biome (2.4.15)

[error] 36-36: Property key must be double quoted

(parse)


[error] 36-36: unexpected character =

(parse)


[error] 36-36: expected , but instead found " "

(parse)


[error] 36-36: expected : but instead found }

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/LinkDotNet.Enumeration/video.json` around lines 35 - 36, In
video.json there is a JSON syntax error: the property SpeakTest is written as
SpeakTest=" " instead of a proper JSON key/value pair; update the object that
contains "typeStep" and "arg" so the SpeakTest property is quoted and uses a
colon (i.e. "SpeakTest": " "), ensuring commas and surrounding braces remain
valid for the array/object in
v2/rscg_examples/LinkDotNet.Enumeration/video.json.

@ignatandrei ignatandrei merged commit 243b734 into main May 27, 2026
3 checks passed
@ignatandrei ignatandrei deleted the 496-httpsgithubcomlinkdotnetenumeration branch May 27, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

https://github.com/linkdotnet/Enumeration

2 participants