Skip to content

Conversation

cemahseri
Copy link

Fixes: #747

@wx0xm wx0xm requested a review from Copilot September 26, 2025 19:24
Copy link

@Copilot 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

This PR fixes the Clone() method in the Query class to perform deep cloning instead of shallow cloning, addressing issue #747. The fix ensures that nested objects like Parent queries and Includes are properly cloned rather than sharing references.

  • Implements deep cloning for Parent query references
  • Adds proper cloning for Includes collection with new Clone() method
  • Creates independent copy of Variables dictionary

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
QueryBuilder/Query.cs Updates Clone() method to deep clone Parent, Includes, and Variables properties
QueryBuilder/Include.cs Adds new Clone() method to enable deep cloning of Include objects

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wx0xm
Copy link
Contributor

wx0xm commented Sep 26, 2025

@cemahseri the PR is failing to build

@wx0xm wx0xm force-pushed the main branch 2 times, most recently from c3ae82e to 981f444 Compare September 27, 2025 14:48
@cemahseri
Copy link
Author

copilot is high on k2/spice, don't trust it. the pr builds just fine

1>------ Build started: Project: QueryBuilder, Configuration: Release Any CPU ------
1>QueryBuilder -> C:\Windows\System32\querybuilder\QueryBuilder\bin\Release\net8.0\SqlKata.Core.dll
2>------ Build started: Project: SqlKata.Execution, Configuration: Release Any CPU ------
2>SqlKata.Execution -> C:\Windows\System32\querybuilder\SqlKata.Execution\bin\Release\net8.0\SqlKata.Execution.dll
3>------ Build started: Project: QueryBuilder.Tests, Configuration: Release Any CPU ------
3>QueryBuilder.Tests -> C:\Windows\System32\querybuilder\QueryBuilder.Tests\bin\Release\net8.0\QueryBuilder.Tests.dll
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

@wx0xm
Copy link
Contributor

wx0xm commented Oct 1, 2025

copilot is high on k2/spice, don't trust it. the pr builds just fine

1>------ Build started: Project: QueryBuilder, Configuration: Release Any CPU ------
1>QueryBuilder -> C:\Windows\System32\querybuilder\QueryBuilder\bin\Release\net8.0\SqlKata.Core.dll
2>------ Build started: Project: SqlKata.Execution, Configuration: Release Any CPU ------
2>SqlKata.Execution -> C:\Windows\System32\querybuilder\SqlKata.Execution\bin\Release\net8.0\SqlKata.Execution.dll
3>------ Build started: Project: QueryBuilder.Tests, Configuration: Release Any CPU ------
3>QueryBuilder.Tests -> C:\Windows\System32\querybuilder\QueryBuilder.Tests\bin\Release\net8.0\QueryBuilder.Tests.dll
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I was trying to build it locally but maybe I was missing something, I will try again tonight

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.

Clone() method in Query class doesn't Clone deeply enough.
2 participants