Knight Data Access Layer
CreateClassFromTable Method (DataHelper)
Example 




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class : CreateClassFromTable Method
The namespace
The name of the table
The output path for the C# file
Create a C# class from a table
Syntax
Public Sub CreateClassFromTable( _
   ByVal namespaceString As String, _
   ByVal tableName As String, _
   ByVal outputFilePath As String _
) 
Dim instance As DataHelper
Dim namespaceString As String
Dim tableName As String
Dim outputFilePath As String
 
instance.CreateClassFromTable(namespaceString, tableName, outputFilePath)
public void CreateClassFromTable( 
   string namespaceString,
   string tableName,
   string outputFilePath
)
public: void CreateClassFromTable( 
   string* namespaceString,
   string* tableName,
   string* outputFilePath
) 
public:
void CreateClassFromTable( 
   String^ namespaceString,
   String^ tableName,
   String^ outputFilePath
) 

Parameters

namespaceString
The namespace
tableName
The name of the table
outputFilePath
The output path for the C# file
Remarks
If no path is specified for the filename, it will default to the current directory. The current directory is normally bin\Debug.
Example
//Get the current thread static safe instance of the helper
IDataHelper db = DataHelper.SessionFactory();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
//Open the database connection
db.OpenConnection();
 
db.CreateClassFromTable("ACME.InvoiceSystem.Business", 
                         "Invoices", 
                         string.Format("{0}\\Invoice.cs", 
                                       Environment.CurrentDirectory));
 
//Close the database connection
db.CloseConnection();
'Get the current thread static safe instance of the helper
Dim db As IDataHelper = DataHelper.SessionFactory()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
'db.UserName = "John Smith 1234"
'db.LicenseKey = "asdfl219=="
 
'Open the database connection
db.OpenConnection()
 
db.CreateClassFromTable("ACME.InvoiceSystem.Business", "Invoices", String.Format("{0}\Invoice.cs", Environment.CurrentDirectory))
 
'Close the database connection
db.CloseConnection()
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DataHelper Class
DataHelper Members