mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 修复 新功能 BeginEdit bug;#397
This commit is contained in:
parent
18cabd22b9
commit
e092d10fee
@ -545,7 +545,7 @@ namespace FreeSql
|
|||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void BeginEdit(List<TEntity> data)
|
public void BeginEdit(List<TEntity> data)
|
||||||
{
|
{
|
||||||
if (data == null || data.Any() == false) return;
|
if (data == null) return;
|
||||||
if (_table.Primarys.Any() == false) throw new Exception($"不可进行编辑,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data.First())}");
|
if (_table.Primarys.Any() == false) throw new Exception($"不可进行编辑,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data.First())}");
|
||||||
_statesEditing.Clear();
|
_statesEditing.Clear();
|
||||||
_dataEditing = data;
|
_dataEditing = data;
|
||||||
|
@ -552,6 +552,23 @@ namespace FreeSql.Tests
|
|||||||
cts.RemoveAt(1);
|
cts.RemoveAt(1);
|
||||||
|
|
||||||
Assert.Equal(3, repo.EndEdit());
|
Assert.Equal(3, repo.EndEdit());
|
||||||
|
|
||||||
|
g.sqlite.Delete<BeginEdit01>().Where("1=1").ExecuteAffrows();
|
||||||
|
repo = g.sqlite.GetRepository<BeginEdit01>();
|
||||||
|
cts = repo.Select.ToList();
|
||||||
|
repo.BeginEdit(cts);
|
||||||
|
|
||||||
|
cts.AddRange(new[] {
|
||||||
|
new BeginEdit01 { Name = "分类1" },
|
||||||
|
new BeginEdit01 { Name = "分类1_1" },
|
||||||
|
new BeginEdit01 { Name = "分类1_2" },
|
||||||
|
new BeginEdit01 { Name = "分类1_3" },
|
||||||
|
new BeginEdit01 { Name = "分类2" },
|
||||||
|
new BeginEdit01 { Name = "分类2_1" },
|
||||||
|
new BeginEdit01 { Name = "分类2_2" }
|
||||||
|
});
|
||||||
|
|
||||||
|
Assert.Equal(7, repo.EndEdit());
|
||||||
}
|
}
|
||||||
class BeginEdit01
|
class BeginEdit01
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user