Skip to content

Conversation

@arika0093
Copy link
Owner

@arika0093 arika0093 commented Dec 6, 2025

Enhance the code structure by replacing hardcoded DTO attributes with a dedicated method, improving maintainability. Rename the ExportAll method for clarity and add documentation for auto-generated DTO attributes. Introduce the EditorBrowsable attribute to control visibility of internal DTO attributes.

Summary by CodeRabbit

  • Refactor
    • Reorganized internal code generation processes to improve maintainability. Enhanced DTO attribute handling through centralized code snippet management and better code organization.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

Walkthrough

The pull request refactors DTO attribute generation by centralizing it into a dedicated method, renames a public API method in the source code generator infrastructure, and updates the post-initialization registration to use the renamed method. These changes maintain existing functionality while improving code organization.

Changes

Cohort / File(s) Summary
Source Code Snippets Refactoring
src/Linqraft.Core/GenerateSourceCodeSnippets.cs
Renamed public method ExportAll() to ExportAllConstantSnippets(), added new public method BuildDtoCodeAttributes() that returns DTO attribute source code, and introduced new public constant LinqraftAutoGeneratedDtoAttribute for centralized attribute metadata.
Post-Initialization Registration Update
src/Linqraft.SourceGenerator/SelectExprGenerator.cs
Updated post-initialization source generation call to use the renamed ExportAllConstantSnippets method directly, removing the previous lambda wrapper pattern.
DTO Attribute Generation
src/Linqraft.Core/GenerateDtoClassInfo.cs
Replaced explicit attribute line insertions with centralized generation via GenerateSourceCodeSnippets.BuildDtoCodeAttributes(), applying indentation through CodeFormatter.IndentCodeByLevel().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward refactoring with consistent pattern changes across files
  • Method rename and extraction are mechanical transformations
  • Verify that BuildDtoCodeAttributes() output matches the previously explicit attribute lines

Possibly related PRs

Poem

🐰 Code once scattered, now it's neat,
Attributes gathered, centralized sweet,
One method renamed, the flow stays true,
Refactoring whispers, making things new!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: DTO handling and improve code clarity' directly relates to the main changes: centralizing DTO attribute generation and renaming ExportAll for clarity.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/source-snippet-update

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51cc4eb and 19d8834.

📒 Files selected for processing (3)
  • src/Linqraft.Core/GenerateDtoClassInfo.cs (1 hunks)
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs (6 hunks)
  • src/Linqraft.SourceGenerator/SelectExprGenerator.cs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/Linqraft.{Analyzer,Core}/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

src/Linqraft.{Analyzer,Core}/**/*.cs: Always prefer semantic analysis over string matching; use RoslynTypeHelper instead of string-based type checking
Use ISymbolEqualityComparer for symbol comparisons in analyzer code

Files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
src/Linqraft.Core/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

src/Linqraft.Core/**/*.cs: Keep helper methods lightweight and focused; helper methods are called frequently during analysis
Cache expensive operations in helper methods when possible

Files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
🧠 Learnings (12)
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/**/*.cs : Keep helper methods lightweight and focused; helper methods are called frequently during analysis

Applied to files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.SourceGenerator/SelectExprGenerator.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Analyzer/**/*.cs : Use `TriviaHelper` for formatting to preserve whitespace, comments, and detect line endings for cross-platform compatibility

Applied to files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft/DummyExpression.cs : Do not edit `DummyExpression.cs`; it serves only as a marker for the Source Generator

Applied to files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.SourceGenerator/SelectExprGenerator.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/**/*Helper.cs : Document complex helper methods with XML comments

Applied to files:

  • src/Linqraft.Core/GenerateDtoClassInfo.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Add test cases for source generators to `tests/Linqraft.Tests/`

Applied to files:

  • src/Linqraft.SourceGenerator/SelectExprGenerator.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/**/*.cs : Cache expensive operations in helper methods when possible

Applied to files:

  • src/Linqraft.SourceGenerator/SelectExprGenerator.cs
  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.{Analyzer,Core}/**/*.cs : Always prefer semantic analysis over string matching; use `RoslynTypeHelper` instead of string-based type checking

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/SyntaxHelpers/*.cs : Syntax helpers should be placed in `Linqraft.Core/SyntaxHelpers/` and named `*Helper.cs`

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/RoslynHelpers/*.cs : Roslyn helpers should be placed in `Linqraft.Core/RoslynHelpers/` and named `Roslyn*Helper.cs`

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Core/AnalyzerHelpers/*.cs : Analyzer helpers should be placed in `Linqraft.Core/AnalyzerHelpers/` and named `*Helper.cs`

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Analyzer/**/*.cs : Do not use hardcoded line endings; use `TriviaHelper.EndOfLine(root)` for cross-platform line ending detection

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
📚 Learning: 2025-11-25T12:08:35.849Z
Learnt from: CR
Repo: arika0093/Linqraft PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T12:08:35.849Z
Learning: Applies to src/Linqraft.Analyzer/**/*Analyzer.cs : Define a public const `AnalyzerId` in analyzer classes for use by code fix providers

Applied to files:

  • src/Linqraft.Core/GenerateSourceCodeSnippets.cs
🧬 Code graph analysis (1)
src/Linqraft.SourceGenerator/SelectExprGenerator.cs (1)
src/Linqraft.Core/GenerateSourceCodeSnippets.cs (2)
  • GenerateSourceCodeSnippets (10-320)
  • ExportAllConstantSnippets (13-23)
🔇 Additional comments (8)
src/Linqraft.Core/GenerateDtoClassInfo.cs (1)

139-141: Excellent refactoring to centralize DTO attribute generation.

Replacing the hardcoded attribute insertion with BuildDtoCodeAttributes() improves maintainability and ensures consistency across the codebase. The indentation handling is correct, and the behavior is preserved.

src/Linqraft.SourceGenerator/SelectExprGenerator.cs (1)

23-25: Improved clarity with method rename and direct method group reference.

The new method name ExportAllConstantSnippets is more descriptive than ExportAll, and using the method group directly is more concise than the lambda wrapper. This aligns well with the PR's goal to improve code clarity.

src/Linqraft.Core/GenerateSourceCodeSnippets.cs (6)

13-22: Well-structured refactoring with clearer naming.

The renamed method ExportAllConstantSnippets better describes its purpose, and the addition of LinqraftAutoGeneratedDtoAttribute registration ensures the new attribute is available throughout the generated codebase.


130-137: Good centralization of DTO attribute generation.

This lightweight helper method centralizes the DTO attributes, improving maintainability. The use of fully qualified names (global::) prevents namespace conflicts.

Based on learnings, helper methods should be lightweight and focused—this method meets that requirement.


140-162: Good additions to hide internal implementation details.

Adding EditorBrowsable(EditorBrowsableState.Never) appropriately hides the internal InterceptsLocationAttribute from IntelliSense. The comment header and nullable annotation improve code quality.


164-183: Well-documented marker attribute for analyzer detection.

The new LinqraftAutoGeneratedDtoAttribute is properly documented and configured. The EditorBrowsable attribute appropriately hides it from IntelliSense, and the XML documentation clearly explains its purpose for analyzer usage.


285-293: Good extraction following DRY principle.

Extracting CommentHeaderPartOnProd as a constant eliminates duplication across multiple generated files and provides a single source of truth for the comment header format.


309-309: Remove the unnecessary using System.Collections.Immutable; directive if immutable types are not used in generated code.

The immutable collections using directive should only be included in generated code if the generated expressions actually use ImmutableList, ImmutableHashSet, or other types from System.Collections.Immutable. While immutable types are used elsewhere in the codebase (e.g., in GenerateDtoClassInfo and helper methods), verify that they are actually referenced in the generated output at line 50 and line 189 before including this using statement. If the generated code does not require these types, remove this directive.


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.

@arika0093 arika0093 merged commit ae2ba5f into main Dec 6, 2025
5 checks passed
@arika0093 arika0093 deleted the feat/source-snippet-update branch December 6, 2025 13:14
arika0093 added a commit that referenced this pull request Dec 10, 2025
* refactor: improve code structure and add documentation for auto-generated DTO attribute

* refactor: rename ExportAll method to ExportAllConstantSnippets for clarity

* refactor: replace hardcoded DTO attributes with a dedicated method for better maintainability

* refactor: add EditorBrowsable attribute to internal DTO attributes for better visibility control

(cherry picked from commit ae2ba5f)
@arika0093 arika0093 mentioned this pull request Dec 10, 2025
arika0093 added a commit that referenced this pull request Dec 10, 2025
* Fix: Remove parent class nesting from implicit DTOs in hash namespaces (#219)

* Initial plan

* Add test for issue: implicit DTOs should not be nested in parent class when using hash namespace

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Fix: Implicit DTOs should not be nested in parent class when using hash namespace

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
(cherry picked from commit dd2d380)

* Fix nested SelectExpr inconsistency between playground and source generator (#221)

* Initial plan

* Add shared IsNestedInsideAnotherSelectExpr helper and use in playground and source generator

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Add comprehensive tests for nested SelectExpr consistency fix

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Remove tests for nested SelectExpr type verification

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
Co-authored-by: Arika Ishinami <delete0093@gmail.com>
(cherry picked from commit a25737e)

* docs: Add IntroductionSection component and improve accessibility (#223)

* feat: add IntroductionSection component for query-based DTO generation

* fix: add translate attribute to improve accessibility in playground components

* refactor: remove custom animation definitions from tailwind.css

(cherry picked from commit 2a039c0)

* Fix nested SelectExpr code generation: parent class qualification, array types, and comment verbosity (#222)

* Initial plan

* Initial analysis of nested SelectExpr issues

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Fix Issues 1 and 3 for nested SelectExpr - Issue 2 still in progress

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Fix Issue 2 - array property types now correctly include [] suffix

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Refactor array type detection into helper method per code review

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Address PR review comments: rename test file, remove qualifiers with partial declarations, improve comments, extract method

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Clarify that partial class declarations are required for nested DTO generation

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
(cherry picked from commit a163791)

* docs: separate README contents to other files (#224)

(cherry picked from commit 29b0301)

* Fix: set default value of settingsExpanded to false in Sidebar component

(cherry picked from commit a34d686)

* docs: add comprehensive documentation for Nested SelectExpr feature

(cherry picked from commit 97439c9)

* Revert "docs: add comprehensive documentation for Nested SelectExpr feature"

This reverts commit 97439c9.

(cherry picked from commit 755698c)

* docs: add Nested SelectExpr documentation for reusable DTOs (#225)

* docs: add Nested SelectExpr documentation for reusable DTOs

* docs: update Nested SelectExpr documentation with important notes and usage requirements

* upd

* Fix GitHub Issue link in nested-selectexpr.md

(cherry picked from commit 64b9787)

* fix: NestedSelectExprTest and update documentation (#229)

* Fix: update Issue207_NestedSelectExprTest to support partial classes and remove .NET 9 specific warnings

* Fix: update documentation for Nested SelectExpr to clarify beta status and remove .NET 9+ recommendation

(cherry picked from commit 1aa5ec7)

* Document explicit class naming for nested DTOs

Added section on explicit class naming in nested DTOs.

(cherry picked from commit 1ddc079)

* Enhance library comparison with GitHub stars

Updated the library comparison table to include GitHub repository star counts for each library.

(cherry picked from commit d875f80)

* Update Docs link to point to library directory

(cherry picked from commit 59498e4)

* Refactor Order example to use records and facets

Updated the example to use records and facets for Order and OrderChild.

(cherry picked from commit c66f8b8)

* Add pre-built expression tree caching for IQueryable operations (#234)

* Initial plan

* Add pre-built expression tree configuration and implementation

- Added LinqraftUsePrebuildExpression configuration option (default: false)
- Created ExpressionTreeBuilder helper class for generating cached expression fields
- Updated SelectExprInfoAnonymous to use pre-built expressions when enabled
- Updated SelectExprInfoNamed to use pre-built expressions when enabled
- Updated SelectExprInfoExplicitDto to use pre-built expressions when enabled
- Pre-built expressions only apply to IQueryable (not IEnumerable)
- Pre-built expressions are disabled when captures are used

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Refactor static field generation to class level

- Moved static field generation from method body to class level
- Added GenerateStaticFields() virtual method to SelectExprInfo
- Updated SelectExprGroups to collect and pass static fields
- Updated GenerateSourceCodeSnippets to output static fields before methods
- Fixed null reference warning in SelectExprGroups

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Complete pre-built expression tree implementation

- Fixed CompilerVisibleProperty list to include LinqraftUsePrebuildExpression
- Anonymous types cannot use pre-built expressions (result type is compiler-generated)
- Pre-built expressions only work for named/predefined/explicit DTO types
- Added comprehensive tests for IQueryable with different DTO patterns
- All tests passing with pre-built expressions enabled

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Add LinqraftUsePrebuildExpression to all CompilerVisibleProperty lists

- Updated examples/Directory.Build.props with new configuration property
- Fixed playground/Services/CodeGenerationService.cs to use updated API signature
- All projects now support the new LinqraftUsePrebuildExpression configuration

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Add LinqraftUsePrebuildExpression property to project files

* Fix code generation issues per review feedback

- Use 'var' instead of explicit type in expression initialization (line 93)
- Remove unnecessary '!' null-forgiving operator when fieldName is not null
- Fix indentation of generated multi-line lambda expressions
- Use explicit Expression<> type instead of 'as' operator (lambdas cannot use 'as')

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Refactor to use direct expression initialization per review feedback

- Updated documentation in global-properties.md for LinqraftUsePrebuildExpression
- Added note about captures not supporting pre-built expressions
- Refactored ExpressionTreeBuilder to directly initialize expression fields (no lazy init)
- Removed GenerateNamedExpressionTreeInitialization and GenerateAnonymousExpressionTreeInitialization
- Expression trees now initialized at field declaration, eliminating null checks
- Updated SelectExprInfoNamed and SelectExprInfoExplicitDto to use new approach
- Added test for multiple DTO types to verify pre-built expressions work correctly
- All 6 tests passing

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Address final review feedback: readonly, indentation, remove test, add playground toggle

- Added 'readonly' keyword to static expression fields for immutability
- Fixed indentation: ensured proper line ending with AppendLine for multi-line expressions
- Deleted Linqraft.Tests.Configuration project as requested
- Removed project reference from Linqraft.slnx
- Added toggle for LinqraftUsePrebuildExpression in playground Settings section
- All tests passing (130/130)

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* revert: reset Linqraft.Tests.Configuration

* Fix indentation in BuildExprCodeSnippets for static fields

* Add static fields generation to expression code snippets

* formatt

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
Co-authored-by: Arika Ishinami <delete0093@gmail.com>
(cherry picked from commit 1761753)

* chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 7 (#236)

Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4 to 7.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v7)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 107f2d2)

* Bump AutoMapper from 15.1.0 to 16.0.0 (#237)

---
updated-dependencies:
- dependency-name: AutoMapper
  dependency-version: 16.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 623b9fa)

* feat: optimize DTO generation and performance documentation (#235)

* Refactor GenerateDtoClasses method for improved readability and performance

* Add caching for pre-built expressions in SelectExprInfoNamed

* Refactor nullable access conversion to simplify default value handling

* Update performance documentation to clarify benchmarks and improve readability

* Update README to simplify performance and FAQ sections

* Fix nullable type handling in GetDefaultValueForType method

(cherry picked from commit 54005a1)

* formatted

(cherry picked from commit 11122cb)

* chore: update commit message format for csharpier workflow

(cherry picked from commit 735eb9f)

* playground: enable ScrollBeyondLastLine and update StickyScroll options in EditorPane and PreviewPane

(cherry picked from commit 9bc3057)

* Deduplicate DTO class definitions globally across all generated files (#240)

* Initial plan

* Fix duplicate ChildDto generation for same-shaped nested DTOs in Select expressions

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Improve code comments based on review feedback

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Fix duplicate DTO class definitions by deduplicating at generation point

Reverted changes to DtoProperty.cs and implemented deduplication in
GenerateSourceCodeSnippets.BuildDtoCodeSnippetsGroupedByNamespace instead.
This ensures DTOs with the same FullName (namespace + class name) are only
generated once, even when used across multiple SelectExpr calls.

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Implement global DTO deduplication across all files

- Collect all DTOs from all SelectExpr groups
- Deduplicate globally by FullName before generation
- Generate all DTOs in a single shared GeneratedDtos.g.cs file
- Each expression group file now only contains expression methods
- This ensures DTOs are not duplicated even when used across different files

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

* Refactor DTO generation based on code review feedback

- Moved global DTO deduplication logic to GenerateSourceCodeSnippets.BuildGlobalDtoCodeSnippet
- Separated SelectExprGroups.GenerateCode into two methods: GenerateCode and GenerateCodeWithoutDtos
- Made GenerateCommentHeaderPart and GenerateHeaderFlagsPart public for cross-namespace use
- Renamed test files to Issue239_* pattern for clarity
- Updated playground CodeGenerationService to use new global DTO deduplication
- Fixed null reference warning in playground service

Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
(cherry picked from commit 16b287e)

* refactor: DTO handling and improve code clarity (#216)

* refactor: improve code structure and add documentation for auto-generated DTO attribute

* refactor: rename ExportAll method to ExportAllConstantSnippets for clarity

* refactor: replace hardcoded DTO attributes with a dedicated method for better maintainability

* refactor: add EditorBrowsable attribute to internal DTO attributes for better visibility control

(cherry picked from commit ae2ba5f)

* fix

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arika0093 <4524647+arika0093@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants