有没有经验丰富的VB编译查询语法?我在C#中使用了几次,但似乎无法进行翻译。我的代码如下:
#Region "Locals"
'Data context objects '
Private _dbOrderInfo As New OrderInfoDataContext
#End Region
#Region "Delegates"
Public Shared ReadOnly Func(_dbOrderInfo, Boolean, IQueryable(Of SalesRep))
#End Region
#Region "Compiled Queries"
Public Shared Function(Of _dbOrderInfo, boolean, IQueryable(Of SalesRep)) _
SalesRepsByStatus = CompiledQuery.Compile( _
Function(db As _dbOrderInfo, active As Boolean) _
From sr In db.tblSU4SalesRep Where sr.Active = active)
End Function
#End Region
答案 0 :(得分:0)
在您的代码中,您似乎在引用方法参数中的实例_dbOrderInfo
而不是类型(OrderInfoDataContext)
。通过引用类型来查看它是否有效。此外,您可能需要查看this