PDA

View Full Version : سوال: مشکل توابع در Entity



shahab_ksh
دوشنبه 07 اسفند 1391, 13:05 عصر
کد زیر رو در نظر بگیرید



Dim Db As New LinqUsersDataContext

Dim Query = From c In Db.Users Select c



حالا من میخام این جستجو رو انجام بدم



Query = Query.Where(Function(r) AccessThisRow(c.AccessRoles))


و تابع AccessThisRow


Public Function AccessThisRow(StrValue As String) As Boolean

Dim IsValid As Boolean = False
If StrValue <> "" Then
For Each Rol In Roles.GetRolesForUser(User.Identity.Name.ToLower)
Dim Str As String = "," & Rol & ","
If StrValue.Contains(Str.ToString) Then
IsValid = True
End If
Next
End If

Return IsValid

End Function


این ارور رو میده

Method 'Boolean AccessThisRow(System.String)' has no supported translation to SQL.