Knight Data Access Layer
Creating Classes
Basic Tasks C# > Generation > Creating Classes

Knight Data Access Layer contains methods to generate C# from tables in a database.  If no path is specified for the filename, it will default to the current directory.  The current directory is normally bin\Debug.  Here is an example:

 

//Get the current instance of the helper

IDataHelper db = DataHelper.SessionFactory();

 

//The parameters are the namespace, the table name, and the class name

db.CreateClassFromTable(
"ACME.InvoiceSystem.Business",

"Invoices",

string.Format("{0}\\Invoice.cs",

Environment.CurrentDirectory));