带有join groupBy和sortBy的FSharp查询中的NotSupportedException

时间:2012-09-13 15:27:50

标签: f#

我有这个查询(使用Linq2Sql类型提供程序):

let q = query {
  for zj in db.ZAJEZD do
  join zr in db.ZARIZENI on (zj.ZARIZENI = zr.ZARIZENI1)
  where (zj.AKCE = ac)
  groupBy zj.ZARIZENI into gZj
  sortBy gZj.Key
  select gZj.Key
}

在运行时我得到NotSupportedException:

Additional information: The member 'System.Linq.IGrouping`2[System.String,System.Tuple`2[Web.DataLayer.Data+dbSchema+ServiceTypes+ZAJEZD,Web.DataLayer.Data+dbSchema+ServiceTypes+ZARIZENI]].Key' has no supported translation to SQL.

当我删除sortBy子句时,它运行良好。 Key的类型为string。那么将它转换为sql会有什么问题?

顺便问一下,如何用复合键写连接?

由于

0 个答案:

没有答案