Exemplo n.º 1
0
        internal static User GetByIdFromCache(int id)
        {
            User result = null;
            var  cache  = QPContext.GetUserCache();

            if (cache != null && cache.ContainsKey(id))
            {
                result = cache[id];
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Возвращает список по ids
        /// </summary>
        internal static IEnumerable <User> GetList(IEnumerable <int> ids)
        {
            var result = new List <User>();
            var cache  = QPContext.GetUserCache();

            if (cache != null)
            {
                result.AddRange(ids.Select(id => cache.ContainsKey(id) ? cache[id] : GetRealById(id)));
            }
            else
            {
                IEnumerable <decimal> decIDs = Converter.ToDecimalCollection(ids).Distinct().ToArray();
                result = MapperFacade.UserMapper.GetBizList(QPContext.EFContext.UserSet.Where(f => decIDs.Contains(f.Id)).ToList());
            }

            return(result);
        }