使用EF6连接SQL2012生成的Edmx,分页时生成的查询语句使用了SQL 2012引入的新特性  OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY,结果在生产环境使用的数据库是SQL Server 2008 R2的,它不支持改特性。

在MSDN上找到一段know Issues:

Targeting the Correct SQL Server Version

 

The Entity Framework targets the Transact-SQL query based on the SQL Server version that is specified in the ProviderManifestToken attribute of the Schema element in the storage model (.ssdl) file. This version might differ from the version of the actual SQL Server you are connected to. For example, if you are using SQL Server 2005, but your ProviderManifestToken attribute is set to 2008, the generated Transact-SQL query might not execute on the server. For example, a query that uses the new date time types that were introduced in SQL Server 2008 will not execute on earlier versions of the SQL Server. If you are using SQL Server 2005, but your ProviderManifestToken attribute is set to 2000, the generated Transact-SQL query might be less optimized, or you might get an exception that says that the query is not supported. For more information, see the CROSS and OUTER APPLY Operators section, earlier in this topic.

Certain database behaviors depend on the compatibility level set to the database. If your ProviderManifestToken attribute is set to 2005 and your SQL Server version is 2005, but the compatibility level of a database is set to "80" (SQL Server 2000), the generated Transact-SQL will be targeting SQL Server 2005, but might not execute as expected due to the compatibility level setting. For example, you might lose ordering information if a column name in the ORDER BY list matches a column name in the selector.

ProviderManifestToken 从2012设置为2008之后,果断成了。

Entity Framework 连接低版本数据库的更多相关文章

  1. Linq to Entity中连接两个数据库时要注意的问题

    Linq to Entity中连接两个数据库时要注意的问题 今天大学同学问了我一个问题,Linq to Entity中连接两个数据库时,报错“指定的 LINQ 表达式包含对与不同上下文关联的查询的引用 ...

  2. Entity Framework连接Mysql数据库并生成Model和DAL层

    Entity Framework (EF,ADO.NET Entity Framework)是微软官方提供的.NET平台的ORM框架.相比于LINQ TO SQL,EF框架具有很明显的优势: EF框架 ...

  3. entity framework 连接 oracle 发布后出现的问题(Unable to find the requested .Net Framework Data Provider)

    用entity framework 搭建的一个windows 程序,在vs中用oracle 的ODT 工具连接oracle数据库,昨天发布后出现下面一个错误, System.ArgumentExcep ...

  4. ASP.NET MVC+Entity Framework 4.1访问数据库

    Entity Framework 4.1支持代码优先(code first)编程模式:即可以先创建模型类,然后通过配置在EF4.1下动态生成数据库. 下面演示两种情形: 1.代码优先模式下,asp.n ...

  5. ABP .Net Core Entity Framework迁移使用MySql数据库

    一.迁移说明 ABP模板项目Entity Framework Core默认使用的是Sql Server,也很容易将数据库迁移到MySQL,步骤如下. 二.迁移MySQL步骤 1. 下载项目 请到 ht ...

  6. UWP: 在 UWP 中使用 Entity Framework Core 操作 SQLite 数据库

    在应用中使用 SQLite 数据库来存储数据是相当常见的.在 UWP 平台中要使用 SQLite,一般会使用 SQLite for Universal Windows Platform 和 SQLit ...

  7. Sql Server本地高版本备份数据备份至远程低版本数据库方法

    想要将Sqlserver高版本备份的数据还原到低版本SqlServer2008R2上去,但是这在SqlServer中是没法直接还原数据库的,通过以下方法可以顺利还原. 通过高版本生成sql脚本在低版本 ...

  8. Entity Framework - Func引起的数据库全表查询

    原文:http://www.cnblogs.com/dudu/archive/2012/04/01/enitity_framework_func.html 使用 Entity Framework 最要 ...

  9. 在服务器中使用 Entity Framework 的 Migration 更新数据库

    在开发环境中,每次我们对要对数据库进行更改,比如增加修改表字段等.改好Entity类后,我们只需在Nuget程序包管理控制台运行 update-database 脚本却可: update-databa ...

随机推荐

  1. shell 中变量前"?"的作用

    example: if ($?USER == 0 || $?prompt == 0)   then       ....     if ( $?DS_HOME != 0 ) then if ( ${? ...

  2. 怎么在excel中快速查找重复记录

    假设数字在A列,数字从A1开始:方法一:辅助列中输入公式,数据重复时会出现“重复”提示.=IF(COUNTIF(A:A,A1)>1,"重复","") ,下 ...

  3. 【转】C#调用DLL

    C#中如何调用动态链接库DLL(转)     每种编程语言调用DLL的方法都不尽相同,在此只对用C#调用DLL的方法进行介绍.首先,您需要了解什么是托管,什么是非托管.一般可以认为:非托管代码主要是基 ...

  4. Java基础一

    这是在网上找的知识点 覆盖方法必须满足的条件: 1)子类方法的名称.参数签名和返回类型必须与父类方法的名称.参数签名和返回类型一致,修饰符可以相同也可以不同,但子类的访问权限不能低于父类的访问权限. ...

  5. C#栈

    线性表.栈和队列这三种数据结构的数据元素以及数据元素间的逻辑关系完全相同,差别是线性表的操作不受限制,而栈和队列的操作受到限制.栈的操作只能在表的一端进行, 队列的插入操作在表的一端进行而其它操作在表 ...

  6. 探索软件工程道路上的我III (Θ∀Θ#)

    github地址:https://github.com/JUNYU217/2016-03-08 开发语言:Java 开发工具:UltraEdit || 为月末了,网费欠了...很抱歉的拖了那么久的作业 ...

  7. scikit-learn使用笔记与sign prediction简单小结

    经Edwin Chen的推荐,认识了scikit-learn这个非常强大的python机器学习工具包.这个帖子作为笔记.(其实都没有笔记的意义,因为他家文档做的太好了,不过还是为自己记记吧,为以后节省 ...

  8. KANO模型

    一.满意度的定义 消费者的满意度是取决于他们对企业所提供的产品和服务的事前期待,与实际(感知)效果之间的比较后,用户形成的开心或失望的感觉.就是说,如果购后在实际消费中的实际效果与事前期待相符合,则感 ...

  9. 终于在cmd窗口里出现了颜色了!!!感动ing……

    在窗口的中央打印三行字. 要求: 第一行绿色字 第二行绿底红色 第三行白底蓝色 assume cs:code, ds:data data segment db 'welcome to masm!' d ...

  10. JSWindow对象

    Window 对象 Window 对象表示浏览器中打开的窗口. 如果文档包含框架(frame 或 iframe 标签),浏览器会为 HTML 文档创建一个 window 对象,并为每个框架创建一个额外 ...