Skip to content

Commit 254ce1f

Browse files
committed
Await UpsertEntity in ApplyContentToEntityAsync
Await the UpsertEntity call so the upsert completes before SaveChangesAsync is invoked. This ensures the asynchronous operation finishes and avoids potential race conditions or missing data when saving changes.
1 parent e9bb9fe commit 254ce1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

samples/EntglDb.Sample.Shared/SampleDocumentStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public SampleDocumentStore(
3737
protected override async Task ApplyContentToEntityAsync(
3838
string collection, string key, JsonElement content, CancellationToken cancellationToken)
3939
{
40-
UpsertEntity(collection, key, content);
40+
await UpsertEntity(collection, key, content);
4141
await _context.SaveChangesAsync(cancellationToken);
4242
}
4343

0 commit comments

Comments
 (0)