Knight Data Access Layer
One Line of Code Setup VB.NET
Basic Tasks VB.NET > Creating Database Structure > One Line of Code Setup VB.NET

Incredibly with a single command, you can create the database if it does not exist, create tables that do not exist, and add columns that do not already exist. Here is how it works:

  1. The setup command will pull the default database name or file path from the connection string. 
  2. If it is a file database and the directory does not exist, it will be created
  3. The database is created if it does not already exist
  4. The classes in the specified namespace are checked to see if they exist in the database
  5. Tables are created if they do not exist.
  6. Existing tables are checked to see if they have all the columns
  7. Columns are created that do not exist

 

'Get the current instance of the helper

Dim db As IDataHelper = DataHelper.SessionFactory()

 

'Create Database, Tables, and Add Columns

db.Setup("AcmeCorporation.InvoiceSystem")