使用 ObjectQuery 对本地列表进行子查询
我需要查找状态位于整数本地列表中的所有记录。 在 SQL 中我会这样做
Where Status in (select i from my list)
,但我不知道如何在 Linq 中实现它。
ListData = New IssueTrackerEntities2()
Dim queryString As String = "SELECT VALUE CallList FROM IssueTrackerEntities2.CallList AS CallList"
Dim Status As New List(Of Integer)
queryString += "Where CallList.AssignToValue = @AssignTo"
Dim TicketQuerys As New ObjectQuery(Of CallList)(queryString, ListData)
TicketQuerys.Parameters.Add(New ObjectParameter("AssignTo", AssignToFilter.EditValue))
I need to find all records where the status is in the local list of Integer's.
In SQL I would do
Where Status in (select i from my list)
But I can't figure how to make it happen in Linq.
ListData = New IssueTrackerEntities2()
Dim queryString As String = "SELECT VALUE CallList FROM IssueTrackerEntities2.CallList AS CallList"
Dim Status As New List(Of Integer)
queryString += "Where CallList.AssignToValue = @AssignTo"
Dim TicketQuerys As New ObjectQuery(Of CallList)(queryString, ListData)
TicketQuerys.Parameters.Add(New ObjectParameter("AssignTo", AssignToFilter.EditValue))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Contains 扩展方法是您正在搜索的运算符。
The Contains extension method is the operator you're searching for.