Knight Data Access Layer
Loading with LINQ VB.NET
Basic Tasks VB.NET > Loading Data > Loading with LINQ VB.NET

 

Knight Data Access Layer contains built in LINQ providers for SQL Server, MS Access, Oracle, Firebird, VistaDB, Sqlite, and MySQL. It supports all standard LINQ select expressions including:

 

'Create a new Person to save to the database

Dim person As Person = New Person With {.FirstName = "Greg", .LastName = "Smith", .DateCreated = Date.Now.Date}

 

'Get the current instance of the helper

Dim db As IDataHelper = DataHelper.SessionFactory()

 

'Save it

db.Save(person)

 

Dim query = db.CreateQuery(Of Person)()

Dim persons = query.Where(Function(o) o.FirstName = "Greg")