LINQ to Entities does not recognize the method

前端 未结 3 1767
遇见更好的自我
遇见更好的自我 2020-11-22 00:40

I\'m getting the following error when trying to do a linq query:

LINQ to Entities does not recognize the method \'Boolean IsCharityMatching(System.S

3条回答
  •  不知归路
    2020-11-22 01:37

    If anyone is looking for a VB.Net answer (as I was initially), here it is:

    Public Function IsSatisfied() As Expression(Of Func(Of Charity, String, String, Boolean))
    
    Return Function(charity, name, referenceNumber) (String.IsNullOrWhiteSpace(name) Or
                                                             charity.registeredName.ToLower().Contains(name.ToLower()) Or
                                                             charity.alias.ToLower().Contains(name.ToLower()) Or
                                                             charity.charityId.ToLower().Contains(name.ToLower())) And
                                                        (String.IsNullOrEmpty(referenceNumber) Or
                                                         charity.charityReference.ToLower().Contains(referenceNumber.ToLower()))
    End Function
    

提交回复
热议问题