Пример #1
0
        public virtual async Task <IReadOnlyList <TEntity> > GetAllAsync()
        {
            try
            {
                var entities = await _entities.ToListAsync();

                _context.InvokeEvent(new DatabaseActionEventArgs
                {
                    ActionType = ActionType.GetAll,
                    Path       = $"{_name}Repository/{ActionType.GetAll}"
                });

                return(entities.AsReadOnly());
            }
            catch (Exception ex)
            {
                _context.InvokeEvent(new DatabaseActionEventArgs
                {
                    ActionType = ActionType.GetAll,
                    Path       = $"{_name}Repository/{ActionType.GetAll}",
                    IsErrored  = true,
                    Exception  = ex
                });

                return(new List <TEntity>());
            }
        }