I have the following with EF 5:
var a = context.Posts.Include(x => x.Pack).Select(x => x.Pack.Id).ToList();
This works. Then I tried
I used the accepted answer but had to modify it a bit for EntityFramework Core. In my experience I had to keep the chain going or the previous query references were overwritten.
public IQueryable Include(params Expression>[] includes)
{
IIncludableQueryable query = null;
if(includes.Length > 0)
{
query = _dbSet.Include(includes[0]);
}
for (int queryIndex = 1; queryIndex < includes.Length; ++queryIndex)
{
query = query.Include(includes[queryIndex]);
}
return query == null ? _dbSet : (IQueryable)query;
}