NPoco using LINQ where clauses in vb.net

550 Views Asked by At

I am very interested in the use of LINQ in NPoco (microORM based on PetaPoco), which theoretically can be used to specify simple where clauses. I have been testing them in vb.net but I am not able to achieve the desired results.

Error details:

variable 'x' of type 'MyProjectName.App' referenced from scope '', but it is not defined.

Code:

Imports NPoco
Imports System.Configuration

Public Class NPocoTest

    Public Sub doTest()
        Using db As IDatabase = New Database(ConfigurationManager.AppSettings("mydbconnectionstring"), NPoco.DatabaseType.MySQL)
            Dim app As App = db.FetchBy(Of App)(Function(sql) sql.Where(Function(x) x.name = "groupee")).FirstOrDefault
        End Using
    End Sub

End Class

Public Class App
    Public Property SID As Integer
    Public Property name As String
End Class

Any ideas?

0

There are 0 best solutions below