ADO.NET Data Services - Weird Error

Working on a project that uses ADO.NET Data Services for a small part of it. I put the ADO.NET Data Services portion together (add the files, put the EF data model together, link it up, etc.) on my machine (Windows Server 2008, SQL Server 2008, VS 2008), and it all worked great! Checked it into source control and then went about doing something else, ignorant of the coming problem.

Then the developer who would actually consume it (we’re consuming it in C# using LINQ) came to me saying that nothing worked. 😢 All we get is the generic ADO.NET Data Services error: “An error occurred while processing this request.” We removed the where clauses, and everything worked perfectly, which hinted that the LINQ/EF expression tree was borking out somewhere. So we went to the EF data model, told it to update, and it made a change under the surface—everything worked again?!

image

I love TFS because it allowed me to compare my version and the updated one easily, and there was one tiny change (literally 1 byte!) in the .edmx file (not the .cs backing file, the .edmx file itself). Turns out that in dev, they’re using SQL Server 2005, and I built the model with SQL Server 2008—now note there are zero 2008-specific features in use—but it seems the EF expression tree doesn’t care and tries to use some SQL 2008 magic because it thinks it’s SQL Server 2008. This is controlled by the ProviderManifestToken attribute! Changing that to 2005 (which the update did automatically for me) solved the problem!

image