Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework Error - The version of SQL Server in use does not support datatype 'datetime2'

I am using Entity Framework 4.0 in an ASP.NET 4.0 Web Form.

All is fine on the development server. But when I get to the production server, I my Elmah logs this error

System.ArgumentException
The version of SQL Server in use does not support datatype 'datetime2'.

I did a quick research and found out that datetime2 aka datetime2(7) is the problem and setting ProviderManifestToken="2005" will solve the issue.

My problem is this. My Development Server has SQL Server 2008 R2 and Production Server has SQL Server 2008 Express. So, changing the manifest to 2005 doesn't seem right.

My questions are

  1. Will setting ProviderManifestToken="2005" work?
  2. Why has Entity Framework generated a datetime2 when I haven't used it at all in any of the table?
  3. Is there a better work around?
like image 381
naveen Avatar asked Nov 28 '22 03:11

naveen


1 Answers

I dont see any workaround till date. So if you are using SQL Server 2008 Express, please right click on your edmx, open it with XML (Text) Editor and set ProviderManifestToken="2005".

Doesn't sound that good. But its all I have got as of now.

like image 63
naveen Avatar answered Dec 05 '22 15:12

naveen