mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Update grid save
This commit is contained in:
parent
7bde9352c2
commit
cfb36c9c2e
@ -55,12 +55,14 @@ namespace SqlSugar
|
||||
|
||||
public List<T> GetDeleteList()
|
||||
{
|
||||
//下面代码ToDictionary会有重复错请修改
|
||||
string[] primaryKeys = this.Context.EntityMaintenance.GetEntityInfo<T>().Columns.Where(it => it.IsPrimarykey).Select(it => it.PropertyName).ToArray();
|
||||
var saveListDictionary = this.SaveList.ToDictionary(item => CreateCompositeKey(primaryKeys, item));
|
||||
var saveListDictionary = this.SaveList.Select(item =>
|
||||
new { Key = CreateCompositeKey(primaryKeys, item), Value = item });
|
||||
var deleteList = this.OldList.Where(oldItem =>
|
||||
{
|
||||
var compositeKey = CreateCompositeKey(primaryKeys, oldItem);
|
||||
return !saveListDictionary.ContainsKey(compositeKey);
|
||||
return !saveListDictionary.Any(it=>it.Key==compositeKey);
|
||||
}).ToList();
|
||||
return deleteList;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user