标签:task name node list 深度 await parent turn returns
1 public async Task DeleteModule(EntityDto input) 2 { 3 var id = input.Id; 4 var children = await FindChildrenAsync(id); 5 6 await DeleteAsync(children); 7 8 await _repository.DeleteAsync(id); 9 } 10 /// <summary> 11 /// 删除操作 12 /// </summary> 13 /// <param name="children"></param> 14 /// <returns></returns> 15 public async Task DeleteAsync(List<Module> children) 16 { 17 foreach (var child in children) 18 { 19 var node = await FindChildrenAsync(child.Id); 20 if (node.Count > 0) 21 await DeleteAsync(node); 22 await _repository.DeleteAsync(child); 23 } 24 25 } 26 /// <summary> 27 /// 查找子节点 28 /// </summary> 29 /// <param name="parentId"></param> 30 /// <returns></returns> 31 public async Task<List<Module>> FindChildrenAsync(int? parentId) 32 { 33 return await _repository.GetAllListAsync(p => p.ParentId == parentId); 34 }
标签:task name node list 深度 await parent turn returns
原文地址:https://www.cnblogs.com/cxyzhangjie/p/10214571.html