Edmx datetime2

This version of SQL Server in use does not support datatype datetime2 EF problem.

Tuesday, February 02, 2010 5:40 PM

Had a strange error come up today when I tried to use my home PC to run an Entity Framework project, the EDMX schema (is it a schema) was generated in SQL Server 2008 and my home dev machine has SQL Server 2005.

I wouldn't have thought this would be a problem as I don't use any 2008 specific features (except the intellisense ;P), but alas I was getting a lot of exceptions from my FunctionImports (stored proceedures in Entity Framework).

Upon investigating the stack trace it was telling me that the DateTime2 datatype was not supported in this version of SQL server, Very strange as I am sure that I do not use the Datetime2 or Date datatypes (these are 2008 specific)
 

This is due to the edmx file being generated or updated from a SQL 2008 instance and run against a SQL 2005 instance. I tried about every trick I could think of before reading about it here. Basically all you need to do is to open the EDMX file with XML Editor and change ProviderManifestToken=”2008” to ProviderManifestToken=”2005”. Thanks a bunch Alex Duggleby for the hint!

From The #Crypt Via Alex Duggleby

Just another thing that I hope will be fixed in the forthcoming EF4.

posted @ 2011-03-24 09:04  Devilmsg  阅读(356)  评论(0编辑  收藏  举报