- 增加 BaseEntity SaveMany 方法;

This commit is contained in:
28810
2020-03-06 13:13:47 +08:00
parent b71e7c1b23
commit ab52728f7f
7 changed files with 113 additions and 7 deletions

View File

@ -174,10 +174,15 @@ namespace FreeSql
else whereParentExp = Expression.AndAlso(whereParentExp, whereExp);
}
var propValEach = GetItemValue(item, prop) as IEnumerable;
await _db.Orm.Delete<object>().AsType(tref.RefEntityType)
var subDelete = _db.Orm.Delete<object>().AsType(tref.RefEntityType)
.WithTransaction(_uow?.GetOrBeginTransaction())
.Where(Expression.Lambda<Func<object, bool>>(whereParentExp, deleteWhereParentParam))
.WhereDynamic(propValEach, true).ExecuteAffrowsAsync();
.Where(Expression.Lambda<Func<object, bool>>(whereParentExp, deleteWhereParentParam));
foreach (var propValItem in propValEach)
{
subDelete.WhereDynamic(propValEach, true);
break;
}
await subDelete.ExecuteAffrowsAsync();
}
}
finally

View File

@ -186,10 +186,15 @@ namespace FreeSql
else whereParentExp = Expression.AndAlso(whereParentExp, whereExp);
}
var propValEach = GetItemValue(item, prop) as IEnumerable;
_db.Orm.Delete<object>().AsType(tref.RefEntityType)
var subDelete = _db.Orm.Delete<object>().AsType(tref.RefEntityType)
.WithTransaction(_uow?.GetOrBeginTransaction())
.Where(Expression.Lambda<Func<object, bool>>(whereParentExp, deleteWhereParentParam))
.WhereDynamic(propValEach, true).ExecuteAffrows();
.Where(Expression.Lambda<Func<object, bool>>(whereParentExp, deleteWhereParentParam));
foreach (var propValItem in propValEach)
{
subDelete.WhereDynamic(propValEach, true);
break;
}
subDelete.ExecuteAffrows();
}
}
finally

View File

@ -110,6 +110,13 @@
清空状态数据
</summary>
</member>
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
<summary>
根据 lambda 条件删除数据
</summary>
<param name="predicate"></param>
<returns></returns>
</member>
<member name="M:FreeSql.DbSet`1.Add(`0)">
<summary>
添加