实体框架:生成的SQL - 无法找到数据类型DATETIME2数据类型、实体、框架、SQL

由网友(学会遗忘)分享简介:所以我们迁移开发SQL Server以2008年So we migrated dev sql server to 2008. 我们的UAT的SQL Server仍然是2005年。Our UAT sql server is still 2005.我不得不重新生成我的实体框架模型,一些其他的原因,并在部署我的工作U...

所以我们迁移开发SQL Server以2008年

So we migrated dev sql server to 2008.

我们的UAT的SQL Server仍然是2005年。

Our UAT sql server is still 2005.

我不得不重新生成我的实体框架模型,一些其他的原因,并在部署我的工作UAT我注意到这个错误:

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

无法找到数据类型DATETIME2 的

我分析的数据库,并注意到实体框架生成的输入参数作为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'

这执行罚款,开发,因为DATETIME2是一种存在。但失败时部署到环境与2005年

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 environment compatible?

也许这并不是2008年的升级涉及..但它是不是一个问题,在升级之前,这code并没有改变。

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

推荐答案

看看在MS连接这个错误 - 的解决方法似乎提供一个非常简单的修复

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

此外,还介绍here.

阅读全文

相关推荐

最新文章