开发者

Entity Framework: Generated SQL - cannot find data type datetime2

开发者 https://www.devze.com 2023-03-06 23:32 出处:网络
So we migrated dev sql server to 2008. Our UAT sql server is still 2005. i had to regenerate my entity framework model for some other reasons, and upon deploying my work to UAT i noticed this error

So we migrated dev sql server to 2008.

Our UAT sql server is still 2005.

i had to regenerate my entity framework model for some other reasons, and upon deploying my work to UAT i noticed this error:

cannot find data type datetime2

I profiled the database, and noticed that Entity Framework generated the input parameter as datetime2!

N'@p__linq__0 datetime2(7)',@p__linq__0='9999-12-31 00:00:00'

this executes fine in dev, because datetime2 is a type there. but fails when deployed to environment with 2005.

Is this some sort of known type? Why is entity framework not using regular datetime, and how can i make it cross environm开发者_如何学JAVAent compatible?

perhaps this is not 2008 upgrade related.. but it wasn't an issue before the upgrade and this code has not changed.


Take a look at this 'bug' on MS Connect - the workarounds seem to supply a fairly straightforward fix.

Also covered here.

0

精彩评论

暂无评论...
验证码 换一张
取 消