//using Infrastructure.Domain; //using System.Collections.Generic; //using System.Linq; //namespace Infrastructure.Extensions //{ // public static class TreeEntityExtensions // { // public static List ToTree(this List list) where T : BaseTreeEntity // { // if (list != null) // { // foreach (var item in list) // { // if (item.ParentId.HasValue) // { // item.Parent = list.FirstOrDefault(o => o.Id == item.ParentId.Value); // item.Parent?.Children.Add(item); // } // } // } // return list; // } // } //}