Exemplo n.º 1
0
        public async virtual Task <T> GetAsync(Expression <Func <T, bool> > predicate, bool noTracking = true)
        {
            try
            {
                IQueryable <T> query = _dbSet;
                if (noTracking)
                {
                    query.AsNoTracking();
                }
                if (_includes != null)
                {
                    query = _includes.Expression(query);
                }
                var entity = await query.FirstOrDefaultAsync(predicate);

                return(entity);
            }
            catch (Exception ex)
            {
                _logger.Log(ex);
            }
            return(null);
        }