Knight Data Access Layer
Manually Creating A Session VB.NET
Basic Tasks VB.NET > Creating A Session > Manually Creating A Session VB.NET

Manually Creating A Session

Below is an example of creating a data access layer object without using the session factory.

 

'Build the connection string

Dim builder As New SQLiteConnectionStringBuilder()

Dim databasePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MyDatabase.db")

builder.DataSource = databasePath

 

'Setup the provider

Dim provider As New SqLiteProvider()

provider.ConnectionString = builder.ConnectionString

 

'Manually instantiate a session

Dim db As New DataHelper(provider)

 

Set Licensing

The default is a 30 day trial mode.  Skip this step if you are doing a trial.  After you receive your user name and license key during the purchase process, set it.

db.UserName = "John Smith 1234"

db.LicenseKey = "a9sdkw=="