public virtual IQueryable <TEntity> Query(bool eager = false) { var query = _dbContext.Set <TEntity>().AsQueryable(); if (eager) { foreach (var property in _dbContext.Model.FindEntityType(typeof(TEntity)).GetNavigations()) { query = query.Include(property.Name); } } return(query); }
public GenericRepository(APSContext dbContext) { _dbContext = dbContext; _entities = dbContext.Set <TEntity>(); //_dbContext.CurrentUserId = httpAccessor?.HttpContext?.User?.Claims?.SingleOrDefault(c => c.Type == "id")?.Value; }