示例#1
0
        // GetAll
        public IList <TModel> GetAll <TModel>(bool withDeleted = false)
            where TModel : BaseViewModel
        {
            string        cacheName = typeof(TModel).Name;
            List <TModel> lst       = null;

            if (withDeleted)
            {
                // Silinmiş Kayıtlar Dahil
                lst = _cache.Get <List <TModel> >(cacheName + "_ALL");

                if (lst == null)
                {
                    lst = _repository.GetAll <TModel>().ToList();
                    _cache.Set(cacheName + "_ALL", lst);
                }
            }
            else
            {
                lst = _cache.Get <List <TModel> >(cacheName);

                if (lst == null)
                {
                    lst = _repository.GetAll <TModel>().Where(k => k.Deleted == false).ToList();

                    _cache.Set(cacheName, lst);
                }
            }

            return(lst);
        }
示例#2
0
 public void LoadDefinitionsFromStorage()
 {
     foreach (var definition in _repository.GetAll())
     {
         try
         {
             _loader.LoadDefinition(definition);
         }
         catch (Exception ex)
         {
             _logger.LogError(default(EventId), ex, $"Error loading definition {definition.Id}");
         }
     }
 }
示例#3
0
        public IEnumerable <IDefinition> GetAll()
        {
            IEnumerable <IDefinition> results = _definitionRepo.GetAll();

            return(results);
        }