Propagate query tag comment onto bulk DELETE/UPDATE statements - #491
Merged
snaumenko-st merged 1 commit intoJul 16, 2026
Merged
Conversation
Bulk Delete()/DeleteAsync() and Update()/UpdateAsync() built fresh SqlDelete/SqlUpdate DOM nodes that never carried the .Tag(...) SQL comment, since only SqlSelect exposed a Comment property and the comment was never emitted for DELETE/UPDATE by the compiler. Moves Comment onto the shared SqlQueryStatement base, emits it from VisitDeleteDefault/VisitUpdateDefault (and the SQL Server TOP(N) override, which bypasses the shared defaults), and copies it in QueryOperation.Join() so both bulk operations pick it up.
botinko
approved these changes
Jul 16, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Delete()/DeleteAsync()/Update()/UpdateAsync()(Xtensive.Orm.BulkOperations) built freshSqlDelete/SqlUpdateDOM nodes that never carried the.Tag(...)SQL comment, because onlySqlSelectexposed aCommentproperty and the comment was never emitted for DELETE/UPDATE statements by the compiler.Commentonto the sharedSqlQueryStatementbase (coveringSqlSelect/SqlDelete/SqlUpdatein one place), propagates it throughClone(), and emits it fromVisitDeleteDefault/VisitUpdateDefaultin the baseSqlCompilerthe same wayVisitSelectDefaultalready does.v13compiler'sTOP(N)override forVisit(SqlUpdate)/Visit(SqlDelete), which bypasses the shared base-compiler defaults and would otherwise keep dropping the tag on the primary driver.QueryOperation.Join()(shared byBulkDeleteOperation/BulkUpdateOperation) now copiesselect.Commentonto the target statement.Test plan
Extensions/Xtensive.Orm.BulkOperations.Tests/TagTest.cs(TDD: written first, confirmed red against unfixed code) coveringDelete(),DeleteAsync(),Update(),UpdateAsync(), and the SQL ServerTOP(N)-limited variants of each.dotnet test Extensions/Xtensive.Orm.BulkOperations.Tests— 53 passed, 6 pre-existing provider-specific skips, 0 failed.dotnet test Orm/Xtensive.Orm.Tests --filter FullyQualifiedName~Linq.TagTest— 24 passed (existing SELECT-path tag tests, no regressions).dotnet build Orm.slnx— full solution builds clean.🤖 Generated with Claude Code