>Include is a function of either a DbQuery (
http://msdn.microsoft.com/en-us/library/gg696785%28v=vs.113%29.aspx) or ObjectQuery(
http://msdn.microsoft.com/en-us/library/bb738708%28v=vs.110%29.aspx). DbSet is a subclass of DbQuery (
http://msdn.microsoft.com/en-us/library/system.data.entity.dbset%28v=vs.113%29.aspx). If you want to use include, you need to do so on either the DbSet or a DbQuery. AsQueryable and Where return IQueryable or IEnumerable respectively, not DbQuery.
>
>Also, the title of this thread have nothing to do with the actual contents. You aren't dealing with DataSets, and you are trying to include additional data to the results, not restrictions.
Hi Rob,
Do you know what the base class is doing with this code
public virtual IEnumerable<T> GetAll(params string[] includes)
{
var query = _dbSet.AsQueryable();
includes.ToList().ForEach(x => query = query.Include(x));
return query;
}
?
May be for now I'll not try to change this method. For my purpose I need to return not all rows from the table, but just the ones where parent_id = 0. So, I made a change in the first method which I am going to test and I am not sure what do to with the second method and if I need it or not.
If it's not broken, fix it until it is.
My Blog