Good day! It is necessary to pull out several levels of nesting from the database:
public IEnumerable<Product> GetAllProduct() { return _appContext.Products .Include(o => o.ProductCategory) .Include(o => o.ProductPhotos) .Include(o => o.Сharacteristics) .ThenInclude(op=>op.Property) .Include(o => o.Descriptions) .Include(o => o.ChildrenProduct); } I want to use the generic method:
public virtual IEnumerable<T> GetAll(params Expression<Func<T, object>>[] navigationProperties) { IQueryable<T> dbQuery = _context.Set<T>(); foreach (Expression<Func<T, object>> navigationProperty in navigationProperties) dbQuery = dbQuery.Include(navigationProperty); // ???.ThenInclude(op=>op.Property) ??? return dbQuery.AsNoTracking(); } But I can’t pull out the 2nd nesting level, the code above uses ThenInclude (???), how to use it here? Sorry this is my first question ..