public async Task <Article> GetArticleBomRecursive(Article article, int articleId) { article.ArticleChilds = ArticleBoms.Include(a => a.ArticleChild) .ThenInclude(w => w.WorkSchedules) .Where(a => a.ArticleParentId == articleId).ToList(); foreach (var item in article.ArticleChilds) { await GetArticleBomRecursive(item.ArticleParent, item.ArticleChildId); } await Task.Yield(); return(article); }
public async Task <M_Article> GetArticleBomRecursive(M_Article article, int articleId) { article.ArticleChilds = ArticleBoms.Include(navigationPropertyPath: a => a.ArticleChild) .ThenInclude(navigationPropertyPath: w => w.Operations) .Where(predicate: a => a.ArticleParentId == articleId).ToList(); foreach (var item in article.ArticleChilds) { await GetArticleBomRecursive(article : item.ArticleParent, articleId : item.ArticleChildId); } await Task.Yield(); return(article); }
public bool HasChildren(IDemandToProvider demand) { return(ArticleBoms.Any(a => a.ArticleParentId == demand.ArticleId)); }