Skip to content

Commit 5f74e09

Browse files
CopilotPhenX
andcommitted
Improve dictionary cast in join entity handling
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
1 parent 9f337a9 commit 5f74e09

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/PhenX.EntityFrameworkCore.BulkInsert/Graph/GraphBulkInsertOrchestrator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private async Task InsertJoinRecordsAsync(
300300
}
301301

302302
// Check if the join entity is a dictionary (shared-type entity)
303-
var isDictionary = joinEntry is IDictionary<string, object>;
303+
var dictEntry = joinEntry as IDictionary<string, object>;
304304

305305
// Set FK values for left entity
306306
for (var i = 0; i < fk.Properties.Count; i++)
@@ -309,9 +309,9 @@ private async Task InsertJoinRecordsAsync(
309309
var pkProp = fk.PrincipalKey.Properties[i];
310310

311311
var pkValue = GetPropertyValue(record.LeftEntity, pkProp.Name);
312-
if (isDictionary)
312+
if (dictEntry != null)
313313
{
314-
((IDictionary<string, object>)joinEntry)[fkProp.Name] = pkValue!;
314+
dictEntry[fkProp.Name] = pkValue!;
315315
}
316316
else
317317
{
@@ -326,9 +326,9 @@ private async Task InsertJoinRecordsAsync(
326326
var pkProp = inverseFk.PrincipalKey.Properties[i];
327327

328328
var pkValue = GetPropertyValue(record.RightEntity, pkProp.Name);
329-
if (isDictionary)
329+
if (dictEntry != null)
330330
{
331-
((IDictionary<string, object>)joinEntry)[fkProp.Name] = pkValue!;
331+
dictEntry[fkProp.Name] = pkValue!;
332332
}
333333
else
334334
{

0 commit comments

Comments
 (0)