Skip to content

Conversation

@hongjs
Copy link
Owner

@hongjs hongjs commented Apr 19, 2025

No description provided.

@hongjs hongjs added the Sonar Scan Sonar Scan label Apr 19, 2025
@hongjs hongjs requested a review from Copilot April 19, 2025 15:10
Copy link

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 adds a requirement for a unique key to be present for update and delete bulk operations. It also includes new tests to enforce this behavior and introduces a new Log entity for testing purposes.

  • Enforce unique key requirement by throwing an exception when none is found
  • Update unique key handling across both update and delete batch generation
  • Add new tests and a Log entity to validate the unique key requirement

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
EfCore.BulkOperations/BulkCommand.cs Added unique key check and updated variable names to "keys" in update and delete logic
EfCore.BulkOperations.Test/BulkCommandTest.cs Added tests to verify that a MissingPrimaryKeyException is thrown when no unique key is present
EfCore.BulkOperations.API/Repositories/ApplicationDbContext.cs Added DbSet for the Log entity to support testing
EfCore.BulkOperations.API/Models/Log.cs Introduced a new dummy Log entity
Comments suppressed due to low confidence (1)

EfCore.BulkOperations/BulkCommand.cs:168

  • The unique key check and corresponding exception message is repeated in both update and delete batch generation. Consider extracting this logic and message into a shared helper method or constant to improve maintainability.
if (keys.Count == 0)

@sonarqubecloud
Copy link

@hongjs hongjs merged commit cabdebe into main Apr 19, 2025
3 checks passed
@hongjs hongjs deleted the feature/require-unique-key branch April 19, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Sonar Scan Sonar Scan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant