private IQueryable <TEntity> Find(SearchOptions <TEntity> searchOptions) { IQueryable <TEntity> query = _dbSet; if (searchOptions == null) { return(query); } if (searchOptions.Filter != null) { query = query.Where(searchOptions.Filter); } foreach (var includeProperty in searchOptions.IncludeProperties.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { query = query.Include(includeProperty); } if (searchOptions.OrderBy != null) { query = searchOptions.OrderBy(query); } return(query); }