Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net ActiveRecord Linq/NHibernate Linq未完全生成查询_.net_Vb.net_Linq_Nhibernate_Castle Activerecord - Fatal编程技术网

.net ActiveRecord Linq/NHibernate Linq未完全生成查询

.net ActiveRecord Linq/NHibernate Linq未完全生成查询,.net,vb.net,linq,nhibernate,castle-activerecord,.net,Vb.net,Linq,Nhibernate,Castle Activerecord,鉴于此功能: Public Function Search(ByVal StartIndex As Integer, _ ByVal MaxResults As Integer, _ ByVal AccountNumber As String, _ ByVal LastName As String, _ ByVal FirstName As String, _ ByVal DateOfService As String, _ ByVal CPTCode As String, _ B

鉴于此功能:

Public Function Search(ByVal StartIndex As Integer, _
 ByVal MaxResults As Integer, _
 ByVal AccountNumber As String, _
 ByVal LastName As String, _
 ByVal FirstName As String, _
 ByVal DateOfService As String, _
 ByVal CPTCode As String, _
 ByVal Contract As String, _
 ByVal ClaimNumber As String, _
 ByVal PaidAmount As String, _
 ByVal CheckNumber As String, _
 ByVal SortExpression As String, _
 ByRef count As Integer) As RemitLineItemEntity() 
我试图根据传入函数的参数一次构建一个where子句,如下所示:

    If Not String.IsNullOrEmpty(AccountNumber) Then
        If AccountNumber.Contains("%") Then
            remits = remits.Where(Function(r) r.MedicalRecordNumber Like AccountNumber.Replace("%", "*"))
        Else
            remits = remits.Where(Function(r) r.MedicalRecordNumber = AccountNumber)
        End If
    End If
    If Not String.IsNullOrEmpty(LastName) Then
        If LastName.Contains("%") Then
            remits = remits.Where(Function(r) r.LastName Like LastName.Replace("%", "*"))
        Else
            remits = remits.Where(Function(r) r.LastName = LastName)
        End If
    End If
。。。其他参数的更多if语句

        _log.Debug("Start Count query")
        count = remits.Count()
        _log.Debug("End Count query")
使用lastname=“smith”调用此函数,当我到达
count=relimes.count()
行时,观察SQL事件探查器,它生成如下SQL(与nhibernate生成的SQL相关联):

而不是我所期望的:

Select count(*) from remitline where lastname = "smith"
我在构建where子句时做错了什么?我正在使用Castle ActiveRecord 2.1


TIA更新到最新版本的ActiveRecord(3.0 RC),这个问题就消失了

Select count(*) from remitline where lastname = "smith"