Skip to content

Commit f8a5c62

Browse files
CopilotPhenX
andcommitted
Address code review feedback for documentation and comments
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
1 parent 5cf9062 commit f8a5c62

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/PhenX.EntityFrameworkCore.BulkInsert/Dialect/SqlDialectBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ private string ToSqlExpression<TEntity>(DbContext context, TableMetadata table,
415415
/// Traverses up a member expression chain to find the root parameter expression.
416416
/// This handles both simple properties (e.g., excluded.Name) and complex properties (e.g., excluded.ComplexObject.Property).
417417
/// </summary>
418+
/// <param name="memberExpr">The member expression to traverse.</param>
419+
/// <returns>The root parameter expression if found; otherwise, null if the chain contains unsupported expression types.</returns>
418420
private static ParameterExpression? GetRootParameter(MemberExpression memberExpr)
419421
{
420422
Expression? current = memberExpr.Expression;

tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/Tests/Merge/MergeTestsBase.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public async Task InsertEntities_WithComplexType_UpdateAll(InsertStrategy strate
387387
}
388388

389389
// Act - Second insert with update on conflict
390-
// Using 'inserted' parameter to update all columns (both behave the same for ParameterExpression case)
390+
// The ParameterExpression case in GetUpdates generates UPDATE statements for all columns
391391
var updatedEntities = await _context.InsertWithStrategyAsync(strategy, insertedEntities, o => o.CopyGeneratedColumns = true,
392392
onConflict: new OnConflictOptions<TestEntityWithComplexType>
393393
{
@@ -412,7 +412,7 @@ public async Task InsertEntities_WithComplexType_UpdateWithWhere(InsertStrategy
412412
// Oracle MERGE does not support returning entities
413413
Skip.If(_context.IsProvider(ProviderType.Oracle));
414414

415-
// Arrange
415+
// Arrange - initial Code values are 10 and 20
416416
var entities = new List<TestEntityWithComplexType>
417417
{
418418
new TestEntityWithComplexType
@@ -430,7 +430,7 @@ public async Task InsertEntities_WithComplexType_UpdateWithWhere(InsertStrategy
430430
// Act - First insert (without CopyGeneratedColumns - returns generated IDs via RETURNING)
431431
var insertedEntities = await _context.InsertWithStrategyAsync(strategy, entities);
432432

433-
// Update the complex property name
433+
// Update the complex property - new Code values will be original + 100 (110 and 120)
434434
foreach (var entity in insertedEntities)
435435
{
436436
entity.OwnedComplexType.Name = $"Changed_{entity.OwnedComplexType.Name}";
@@ -446,7 +446,8 @@ public async Task InsertEntities_WithComplexType_UpdateWithWhere(InsertStrategy
446446
Where = (inserted, excluded) => excluded.OwnedComplexType.Code > inserted.OwnedComplexType.Code
447447
});
448448

449-
// Assert - entities should be updated because excluded.Code (110, 120) > inserted.Code (10, 20)
449+
// Assert - entities should be updated because the new Code values (110, 120)
450+
// are greater than the existing values in the database (10, 20)
450451
Assert.Equal(2, updatedEntities.Count);
451452
Assert.All(updatedEntities, e =>
452453
{

0 commit comments

Comments
 (0)