mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 聚合根仓储 InsertOrUpdate 非自增无法插入的 bug;
This commit is contained in:
parent
904e2513a6
commit
6d2b87449d
@ -168,11 +168,8 @@ namespace FreeSql
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
|
if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
|
||||||
{
|
|
||||||
Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
|
Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
|
||||||
return await InsertAsync(entity, cancellationToken);
|
return await InsertAsync(entity, cancellationToken);
|
||||||
}
|
|
||||||
throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, entity)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Task<int> UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) => UpdateAsync(new[] { entity }, cancellationToken);
|
public virtual Task<int> UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) => UpdateAsync(new[] { entity }, cancellationToken);
|
||||||
|
@ -221,11 +221,8 @@ namespace FreeSql
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
|
if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
|
||||||
{
|
|
||||||
Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
|
Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
|
||||||
return Insert(entity);
|
return Insert(entity);
|
||||||
}
|
|
||||||
throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, entity)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int Update(TEntity entity) => Update(new[] { entity });
|
public virtual int Update(TEntity entity) => Update(new[] { entity });
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
||||||
<DelaySign>false</DelaySign>
|
<DelaySign>false</DelaySign>
|
||||||
<Version>1.0.3</Version>
|
<Version>1.0.5</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user