1

Until now I don't find any simple working solution for a dynamic include in Entity Framwework Core 2.1. Below is a simple case where I put the Include in another line that doesn't work.

string[] includes = new[] { "navigationprop" };


var query = _dbContext.Set<T>();
query.Include(includes[0]);

This work:

var query = _dbContext.Set<T>().Include(includes[0]);

In this answer is a similar issue but i think it's too over.

  • Take a look at the the custom `Include` extension method from [Entity Framework Core 2.0.1 Eager Loading on all nested related entities](https://stackoverflow.com/questions/49593482/entity-framework-core-2-0-1-eager-loading-on-all-nested-related-entities/49597502#49597502) – Ivan Stoev Jul 21 '18 at 16:32

0 Answers0