mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 修复 聚合根仓储 InsertOrUpdate 非自增无法插入的 bug;
This commit is contained in:
@ -168,11 +168,8 @@ namespace FreeSql
|
||||
return entity;
|
||||
}
|
||||
if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
|
||||
{
|
||||
Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
|
||||
return await InsertAsync(entity, cancellationToken);
|
||||
}
|
||||
throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, entity)));
|
||||
return await InsertAsync(entity, cancellationToken);
|
||||
}
|
||||
|
||||
public virtual Task<int> UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) => UpdateAsync(new[] { entity }, cancellationToken);
|
||||
|
Reference in New Issue
Block a user