/// <summary> /// 获取指定类型的分类列表,按显示顺序返回 /// </summary> /// <param name="type">分类类型</param> /// <returns></returns> public virtual IList <Entities.GenericClass> GetManyWithCache(string type) { return(ClassListCache.GetOrCreate(type, () => GetMany(query => query.Where(c => c.Type == type) .OrderBy(c => c.DisplayOrder) .Select(c => new { c, p = c.Parent }).ToList() .Select(c => c.c).ToList()), ClassCacheTime)); }
/// <summary> /// 获取指定类型的分类列表 /// 按显示顺序返回,不包括已删除的分类 /// </summary> /// <param name="type">分类类型</param> /// <returns></returns> public virtual IList <Database.GenericClass> GetClasses(string type) { return(ClassListCache.GetOrCreate(type, () => UnitOfWork.ReadData <Database.GenericClass, IList <Database.GenericClass> >(r => { return r.GetMany(c => c.Type == type && !c.Deleted) .OrderBy(c => c.DisplayOrder) .Select(c => new { c, p = c.Parent }).ToList() .Select(c => c.c).ToList(); }), ClassCacheTime)); }