Very odd situation here. For some reason I can't call 'Where', or any other functions, on my IQueryable object.
Here's what I have:
public IQueryable<Employee> Employees
{
get { return _entities.Employees.AsQueryable(); }
}
public ActionResult Index()
{
return View(new HomeViewModel
{
Employees = Employees.Where(e => e.Active == true)
});
}
But Intellisense doesn't pick up the Where function, and I get a Build Error that says:
'System.Linq.IQueryable' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Linq.IQueryable' could be found (are you missing a using directive or an assembly reference?)
But I can call .Where
like this and it works:
public IQueryable<Employee> Employees
{
get { return _entities.Employees.AsQueryable().Where(e => e.Active == true); }
}
I have no idea what's going on.
using System.Linq;
at the top? – Albin Sunnanbo