I’m using specification pattern and I have written a method for adding include to a list. Type of items in this list is Expression<Func<TEntity, object>> where TEntity is my base entity class.
Is there any way to iterate them and add include to an IQueryable field?
>Solution :
You can iterate one your list of includes and add them to your IQueryable variable. Here is a way to do it using LINQ aggreagte method:
query = includes.Aggreagte(queryable, (current, next) =>
current.Include(next));