Thursday, June 14, 2012

EDMX ProviderManifestToken issue between 2005 & 2008

We are in the process of upgrading our SQL Servers to 2008.  While this is going on we still need to maintain and release code to the 2005 boxes.

Our team doesn't do much C# or Entity Framework work, but instead we work mostly in SQL and the BI environment.  We were assigned to update one of the C# projects with a few new fields since we were the recipients of the data.

We spent the morning trying to figure out why code that was working just fine in our new development, qa, and production (2008) environments suddenly quit when promoted back to the older 2005 production system.

All we did was to update the Entity Model to add a couple more integer columns. 

Really, nothing major.  Honest.

Upon doing a stack trace we discovered that it was failing on a datetime2 conversion.  Now, we are not even using a DateTime2 in the sql2008 let alone could we find any reference to it in our project and we know we didn't add that as a data type.

After a bit of investigation (source control to our rescue) we discovered that the before and after versions of one line was causing our problem.

In our original EDMX XML we saw:


 but the new code had:


We manually edited the EDMX XML and the program was back up and running again.

 So I guess the act of editing the Entity Model while working in SQL 2008 was our downfall.  At least we'll be live at the end of the month and good bye to 2005.