I'm having some problem running a LINQ query against custom SharePoint lists.
Using what I've learned from my training manuals, I used SPMETAL to write an entity model class, which I have imported into my project. Then I write the following code
using(myEntityModelDataContext dataContext =
var listData = from data in dataContext.myList select data;
foreach (var listItem in listData)
The error occurs at the "foreach" line on the "listItem" variable.
The Count() method returns the correct number of rows in the list, so I know that is working. And if I replace "myList" with a native SharePoint list in that site (e.g. Tasks), this works fine.
My lists were created in SharePoint Designer, and I don't know if that has anything to do with it.