I am trying to create a multiple include method in my repository to use as follows:
repository.Include<Post>(x => x.Images, x => x.Tags).First(x => x.Id == 1) I tried something as:
public IQueryable<T> Include<T>(params Expression<Func<T, Object>>[] paths) where T : class { return paths.Aggregate(_context.Set<T>(), (x, path) => x.Include(path)); } // Include But I get the error:
Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.DbSet'.
Note that the original include is the following:
public static IQueryable Include( this IQueryable source, Expression> path ) where T : class;
Can I make this work without turning my repository method into static?
Thank You,
Miguel
_context.Set<T>().AsQueryable().