I'm using LINQ to Entities in the Data layer of my application, but am getting hammered by a NotSupportedException in a call to results.ToList(). Here is the function causing the exception:
public List<Organization> GetByLocation(Location l)
{
using (Entities entities = new Entities())
{
var results = from o in entities.OrganizationSet
where o.Location == l
select o;
return results.ToList<Organization>();
}
}
The point is to return a list of all the Organizations at a given Location to the Service Layer (which returns it to the MVC Controller, which converts it to JSON then returns it to the client). The Service Layer is expecting a List to be returned.
This may be pretty simple... any help?