SQL CE和orderby linq子句的问题

Posted

技术标签:

【中文标题】SQL CE和orderby linq子句的问题【英文标题】:problem with SQL CE and orderby linq clause 【发布时间】:2010-05-24 14:49:58 【问题描述】:

我正在使用带有 SQL CE 的 linq,但是对于这样的简单查询:

var points=from i in this.DomainBoundaryPoints orderby i.Index select i;

我收到此错误:

Could not find an implementation of the query pattern for source type 'System.Data.Linq.EntitySet<DAL.DomainBoundaryPoint>'.  'OrderBy' not found.  Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?

SQL CE 是否支持“order by”TSQL 子句?问题出在哪里?

【问题讨论】:

【参考方案1】:

当然 SQL CE 支持orderby...

试着按照错误信息告诉你的去做...

添加对 System.Core 的引用(如果不存在) 为System.Linq 添加 using 指令

【讨论】:

这是我的错。我只是忘记了 System.Linq。 ;)

以上是关于SQL CE和orderby linq子句的问题的主要内容,如果未能解决你的问题,请参考以下文章

请教linq中orderby子句与where子句共存时排序失效问题

Linq to SQL 多个条件 where 子句

C# LINQ 详解 From Where Select Group Into OrderBy Let Join

LINQ OrderBy 和 Where 结合

LINQ的实例

LINQ---查询表达式的结构