I development against a 2008 copy of SQL Server, which normally isn’t a problem, until….. I pushed out my latest code to the production system, which runs SQL 2005, and started smoke testing the system. As soon as I tried to write a record, i got the data type exception. Its painfully in the innerexception.
So, I think to myself, I am not doing anything amazing here. I am just trying to use the Entity Framework to write simple data. Well, apparently there is a tag in the store model saying what version of SQL you are targeting. Is there an easy property window for this? Nope. Open the XML.
If you change the 2008 out the server version you are targeting. 2005 or 2000 if your old, and voila. Up and running. I guess I need to upgrade the production servers to 2008. What a pain.
Right Click your EDMX file and open with XML Editor. Change ProviderManifestToken=2008 to ProviderManifestToken=2005
Then change the following:
<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <!-- EF Runtime content --> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="MyDataModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> <EntityContainer Name="MyDBModelStoreContainer">