无法使用ServiceStack SELECT转换lambda表达式

时间:2014-07-28 11:58:39

标签: c# linq sqlite lambda servicestack

我尝试使用where条件创建一个简单的SELECT,我收到错误消息“无法将lambda表达式转换为'ServiceStack.Ormlite,SqlExpressions',因为它不是委托类型”。

有我的代码:

    // Return on object of the last raw of the PatientGatewaySoftware stored
    public PatientGatewaySoftwareUpdate GetLastRow(PatientGatewaySoftwareUpdate p)
    {
        int version = p.SoftwareVersion;
        return _dbConnection.Select<PatientGatewaySoftwareUpdate>(q => q.Where(x => x.SoftwareVersion = version));
    }

我使用那些程序集:

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Data.Linq;
using System.Web;
using ServiceStack.DataAnnotations;
using ServiceStack;
using ServiceStack.OrmLite;

我认为我的请求没有出错,也许这是ServiceStack的特定程序集?

1 个答案:

答案 0 :(得分:2)

您错过了=子句中的Where标记:

return _dbConnection.Select<PatientGatewaySoftwareUpdate>(q => 
    q.Where(x => x.SoftwareVersion == version));