Skip to content

Commit 231f066

Browse files
CopilotPhenX
andcommitted
Simplify variable naming in OracleDialectBuilder per code review
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
1 parent fe93390 commit 231f066

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleDialectBuilder.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,23 @@ public override string BuildMoveDataSql<T>(
4141
throw new NotSupportedException("Oracle MERGE does not support returning entities. Use ExecuteBulkInsertAsync without returning results when using conflict resolution.");
4242
}
4343

44-
IEnumerable<string> matchColumns;
45-
IReadOnlyList<string> matchColumnsList;
44+
IReadOnlyList<string> matchColumns;
4645
if (onConflictTyped.Match != null)
4746
{
48-
matchColumnsList = GetColumns(target, onConflictTyped.Match).ToList();
47+
matchColumns = GetColumns(target, onConflictTyped.Match).ToList();
4948
}
5049
else if (target.PrimaryKey.Length > 0)
5150
{
52-
matchColumnsList = target.PrimaryKey.Select(x => x.QuotedColumName).ToList();
51+
matchColumns = target.PrimaryKey.Select(x => x.QuotedColumName).ToList();
5352
}
5453
else
5554
{
5655
throw new InvalidOperationException("Table has no primary key that can be used for conflict detection.");
5756
}
58-
matchColumns = matchColumnsList;
5957

6058
// Validate that all match columns are available in the source subquery
6159
var insertedColumnNames = insertedColumns.Select(c => c.QuotedColumName).ToHashSet();
62-
var missingMatchColumns = matchColumnsList.Where(c => !insertedColumnNames.Contains(c)).ToList();
60+
var missingMatchColumns = matchColumns.Where(c => !insertedColumnNames.Contains(c)).ToList();
6361
if (missingMatchColumns.Count != 0)
6462
{
6563
throw new InvalidOperationException(
@@ -111,7 +109,7 @@ public override string BuildMoveDataSql<T>(
111109
q.AppendLine("THEN UPDATE SET ");
112110
// Oracle MERGE: columns in ON clause cannot be updated, so exclude match columns
113111
// Use insertedColumns instead of all columns because the USING subquery only contains insertedColumns
114-
var matchColumnSet = matchColumnsList.ToHashSet();
112+
var matchColumnSet = matchColumns.ToHashSet();
115113
var updateableColumns = insertedColumns.Where(c => !matchColumnSet.Contains(c.QuotedColumName)).ToList();
116114
if (updateableColumns.Count == 0)
117115
{

0 commit comments

Comments
 (0)