예제 #1
0
        private IDictionary <TLookup, TEntity> GetDictionary()
        {
            if (_dictionary != null)
            {
                return(_dictionary);
            }

            var dictionary = new Dictionary <TLookup, TEntity>();

            foreach (var entity in _cacheService.GetAll())
            {
                TLookup lookup;
                if (!Enum.TryParse(entity.Name, out lookup))
                {
                    continue;
                }

                dictionary.Add(lookup, entity);
            }

            _dictionary = dictionary;
            return(_dictionary);
        }
 public static IList <TEntity> GetAllActiveSorted <TEntity, TTransaction>(this IEntityCacheService <TEntity, TTransaction> items, int?id = null)
     where TEntity : class, IIsActive, INamedEntity, IEntityWithIntKey
     where TTransaction : ITransaction
 {
     return(items.GetAll().GetAllActiveSorted(id));
 }
 public static IList <TEntity> GetAllSorted <TEntity, TTransaction>(this IEntityCacheService <TEntity, TTransaction> items)
     where TEntity : class, INamedEntity, IGetIdentifier
     where TTransaction : ITransaction
 {
     return(items.GetAll().GetAllSorted());
 }