Feature/delete top statements - #32
Merged
Merged
Conversation
added 2 commits
September 9, 2026 14:14
…w version of nuget package - Support SQL Server TOP(n) in DELETE/UPDATE via .Top(n) in Storm ORM - Add AppendTopClause helper and update SQL generation logic - Add integration/unit tests for TOP clause and OData filters - Enhance SqlWhereTestEntity with DateOnly/TimeOnly properties - Update ODataFilterStatementGenerator for DateOnly/TimeOnly (.NET 10+) - Upgrade NuGet packages
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
DELETE Top(n) currently risks deleting detail-table rows beyond the limited master delete keyset, and one new SQL-generation test asserts the wrong DELETE TOP clause placement.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds support for honoring .Top(n) on DELETE and UPDATE statements in Storm’s SQL generation, and expands OData filter SQL generation coverage for DateOnly/TimeOnly constants. It also updates several test and analyzer package versions and bumps the shared assembly version.
Changes:
- Apply
TOP (n)clause generation toUPDATEandDELETESQL (previously ignored for these operations). - Add new unit/integration tests for
DELETE/UPDATE Top(n)SQL generation and for OData$filtertranslation involvingDateOnly/TimeOnly. - Update package versions (test SDK, xUnit runner, EF Core in benchmarks, DomainPrimitives) and bump Storm version to
3.5.0.
File summaries
| File | Description |
|---|---|
| Tests/TrackingListTests/AltaSoft.Storm.TrackingListTests.csproj | Updates test SDK + xUnit VS runner package versions. |
| Tests/TestModels/SqlWhereTestEntity.cs | Adds DateOnly/TimeOnly properties to the test entity. |
| Tests/TestModels/Generated/AltaSoft.Storm.Generator/AltaSoft.Storm.Generator.StormGenerator/SqlWhereTestEntity.g.cs | Regenerated model/controller to include the new date/time columns. |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/UserIdTypeConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/UserIdJsonConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/UserId.g.cs | Generator output update (adds warning disables + doc/formatting fixes). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/OpenApiHelper.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CustomerIdTypeConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CustomerIdJsonConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CustomerId.g.cs | Generator output update (adds warning disables + doc/formatting fixes). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CurrencyIdTypeConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CurrencyIdJsonConverter.g.cs | Generator output update (adds warning disables). |
| Tests/TestModels/Generated/AltaSoft.DomainPrimitives.Generator/**/CurrencyId.g.cs | Generator output update (adds warning disables + doc/formatting fixes). |
| Tests/TestModels/AltaSoft.Storm.TestModels.csproj | Bumps DomainPrimitives package references. |
| Tests/OrmTests/TopClauseSqlGenerationTests.cs | New test verifying TOP (n) appears in generated SQL (currently has an incorrect expectation for DELETE syntax). |
| Tests/OrmTests/ODataFilterStatementGeneratorTests.cs | New tests for OData $filter translation for DateOnly/TimeOnly. |
| Tests/OrmTests/DeleteTopIntegrationTests.cs | New integration test validating DELETE ... Top(n) limits deleted rows per call. |
| Tests/OrmTests/AltaSoft.Storm.Tests.csproj | Updates test SDK + xUnit VS runner package versions. |
| Tests/Benchmarks/AltaSoft.Storm.Benchmarks.csproj | Updates EF Core + ConfigurationManager package versions. |
| src/SharedAssemblyInfo.props | Bumps version to 3.5.0. |
| src/AltaSoft.Storm/StormControllerBase.update.cs | Emits UPDATE TOP (n) ... when TopRows is set. |
| src/AltaSoft.Storm/StormControllerBase.delete.cs | Emits DELETE TOP (n) FROM ... when TopRows is set. |
| src/AltaSoft.Storm/StormControllerBase.cs | Adds shared helper AppendTopClause(int?, StringBuilder). |
| src/AltaSoft.Storm/Helpers/ODataWhereStatementGenerator.cs | Adjusts constant handling for NET10 vs older frameworks (date/time constant conversions). |
| Directory.Packages.props | Updates analyzer/build packages; sets Microsoft.OData.Core to 9.0.0 for net10 while keeping 8.4.4 for net8/net9. |
Review details
- Files reviewed: 14/25 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
No description provided.