I'm trying to only return a few columns from a linq to sql query but if I do, it throws the exception:
Explicit construction of entity type 'InVision.Data.Employee' in query is not allowed
Here's the code:
return db.Employees.Select(e => new Employee()
{ EmployeeID = e.EmployeeID, FirstName = e.FirstName,
LastName = e.LastName }).ToList();
If I return everything then it will throw exceptions about circular references because it needs to be serialized to be used in javascript, so I really need to limit the columns... Thanks for any tips you can give me to solve this.