c# 根据父节点id,找到所有的子节点数据
转自:https://blog.csdn.net/q107770540/article/details/7708418
查的是表 Model_info中父节点为p_id时找到所有的子节点的集合
//通过父节点找到所有子节点 public IEnumerable<ModelInfo> GetSonID(string p_id) { var query = from c in _context.Model_Info where c.parent_dbId == p_id select c; return query.ToList().Concat(query.ToList().SelectMany(t => GetSonID(t.object_id))); }