Skip to content

Commit 8f9228a

Browse files
committed
- 修复 DbContext/Repository InsertOrUpdate 无变化时触发 Insert 逻辑报错;#1700
1 parent 2272c46 commit 8f9228a

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

FreeSql.DbContext/DbSet/DbSetAsync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ async public Task AddOrUpdateAsync(TEntity data, CancellationToken cancellationT
507507
await UpdateRangePrivAsync(new[] { data }, false, cancellationToken);
508508
await DbContextFlushCommandAsync(cancellationToken);
509509
affrows = _db._affrows - affrows;
510-
if (affrows > 0) return;
510+
return;
511511
}
512512
if (CanAdd(data, false))
513513
{

FreeSql.DbContext/DbSet/DbSetSync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ public void AddOrUpdate(TEntity data)
579579
UpdateRangePriv(new[] { data }, false);
580580
DbContextFlushCommand();
581581
affrows = _db._affrows - affrows;
582-
if (affrows > 0) return;
582+
return;
583583
}
584584
if (CanAdd(data, false))
585585
{

FreeSql.DbContext/FreeSql.DbContext.xml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)