LINQ to Entities无法识别方法Int32 CompareString

时间:2018-12-21 01:02:33

标签: vb.net entity-framework-6

我正在尝试执行以下查询。但是我收到异常消息:

  

LINQ to Entities无法识别方法'Int32 CompareString(System.String,System.String,Boolean)'方法,并且该方法无法转换为商店表达式。

我将其范围缩小到“在哪里聆听。JudgeName=法官”这一行,但是我看不出为什么不翻译。 JudgeName和法官都是字符串,我正在连接到SQL Server。这是怎么回事?

            Dim query = From hearing In Context.Hearings
                        From appeal In hearing.Appeals
                        From participation In appeal.Participations
                        Where Not appeal.SentDate.HasValue
                        Where appeal.StartDate <= pendingAsOfDate
                        Where hearing.JudgeName = judge

即使简化查询也会产生相同的异常:

        Dim query = From hearing In Context.Hearings
                        Where hearing.JudgeName = "Test"



        Me.HasKey(Function(x) x.HearingId)
        Me.Property(Function(x) x.HearingId).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
        Me.Property(Function(x) x.JudgeName).HasMaxLength(50)

0 个答案:

没有答案