增加 UnitOfWorkManager 类管理工作单元,移除 FreeSql.UnitOfWork.Current 静态属性;

This commit is contained in:
28810
2020-04-22 03:54:26 +08:00
parent 658540774e
commit fc4e834452
10 changed files with 276 additions and 34 deletions

View File

@ -79,7 +79,7 @@ namespace FreeSql
buf.Add(this as TEntity);
buf.AddRange(this.GetAllChilds());
var repo = Orm.GetRepository<TEntity>();
repo.UnitOfWork = UnitOfWork.Current.Value;
repo.UnitOfWork = CurrentUnitOfWork;
buf = repo.Select.WhereDynamic(buf)
.Include(a => ((((((((((a as BaseEntityTree<TEntity, TKey>).Parent
as BaseEntityTree<TEntity, TKey>).Parent
@ -110,7 +110,7 @@ namespace FreeSql
var childs = GetAllChilds();
childs.Add(this as TEntity);
var repo = Orm.GetRepository<TEntity>();
repo.UnitOfWork = UnitOfWork.Current.Value;
repo.UnitOfWork = CurrentUnitOfWork;
repo.Attach(childs);
foreach (var item in childs)
(item as BaseEntity).IsDeleted = false;