LLBLGen Pro ships with two command line tools: CliGenerator.exe for generating code from the command line and CliRefresher.exe for refreshing the relational meta-data from the command line. These tools are available in the LLBLGen Pro installation folder. Their sourcecode is available in the LLBLGen Pro sourcecode archive.
Both tools require access to most of the LLBLGen Pro designer assemblies and the license file. It's therefore recommended, if you compile the tools from sourcecode, to place them in the LLBLGen Pro installation folder.
Validation takes place prior to executing the tools' core engines. If a validation error occurs, the tools will quit and report the validation error(s). To correct the errors, use the designer. The tools will use the preferences set as stored for the executing user, or use the defaults if no preferences are found.
The command line tools work with all supported O/R mapper frameworks and databases / database drivers. The tools return the value 1 if an exception occurred, and 0 if everything went OK. This value is used by Windows to set the %ERRORLEVEL% variable in batch files, and can be used to perform batch statement logic.
To generate sourcecode from the command line, or e.g. in a batch file, use the CliGenerator.exe tool.
Usage:
CliGenerator ProjectFile RootNamespace LanguageName
PlatformName TemplateGroupName PresetName DestinationFolder
ClearDestinationFolder
Or:
CliGenerator ProjectFile
RootNamespace LanguageName PlatformName TemplateGroupName PresetName
DestinationFolder
ClearDestinationFolder LogFile
ClearDestinationFolder can be 0 or 1. A value of 1 means clear
destination folder, 0 means leave the contents.
DestinationFolder
can be a relative path, which should be prefixed with '.\' or '..\'.
GeneratorConfigName and TemplateSetConfigName can contain the
start part of the full name of a configuration. The first found
matching
the string will be used. The utility uses a .config file which specifies the
driver and taskperformer root folder. Be sure to set these config keys to
the right folders if you use different folders in the LLBLGenpro.exe.config
file as well. All folders are relative to the execution folder of the
CliGenerator.exe.
An alternative usage:
CliGenerator
ProjectFile DestinationFolder ClearDestinationFolder
or:
CliGenerator ProjectFile DestinationFolder ClearDestinationFolder LogFile
Here, the RootNamespace, LanguageName, PlatformName,
TemplateGroupName and PresetName are obtained from the project
file. Use this usage after you've already generated code in the designer and
saved the project file afterwards so these parameters have a value in the
project file.
CliGenerator "C:\Myprojects\NHibernate\AdventureWorksNH.llblgenproj" "NH" "C#" ".NET 3.5" "General" "SD.NHibernate (XML mappings and classes)" "C:\Myprojects\NHibernate\Source" 1 "C:/Myprojects/NHibernate/log_AdventureWorks_CS.txt"
CliGenerator "C:\Myprojects\NHibernate\AdventureWorksNH.llblgenproj" "C:\Myprojects\NHibernate\Source" 1
To refresh the relational model data of a given database type from the command line, use the CliRefresher.exe tool.
Usage:
Usage 1:
CliRefresher /u:username /p:password
DatabaseType ShowErrorLog ProjectFile
or usage 2:
CliRefresher
/u:username /p:password ShowErrorLog ProjectFile
or usage 3:
CliRefresher DatabaseType ShowErrorLog ProjectFile
or usage 4:
CliRefresher ShowErrorLog ProjectFile
DatabaseType is a numeric value and can be:
1 (for MS Access)
2 (for IBM DB2)
3 (for Firebird)
4 (for MySQL)
5 (for Oracle (MS Oracle ADO.NET Provider)
6
(for Oracle (ODP.NET ADO.NET provider)
7 (for
PostgreSql)
8 (for SQL Server)
9
(for Sybase ASA)
10 (for Sybase ASE)
ShowErrorLog is a numeric value and can be 0 or 1. If specified as
1, it will produce the error log of the relational model data retrieval onto
stdout.
Usage 3 and 4 will use the credentials specified in the
project file as-is. Passwords are never stored in project files.
Usage 2
and 4 will refresh the first database type encountered in the project. If
there's only one database type, no need to specify it.
The
CliRefresher will obtain meta-data for all elements found of the same type
in the current targeted catalogs/schemas, if at least one element of that
type is in the relational model data to refresh. Example: if the relational
model data to refresh contains a schema S with 4 tables and 1 view, the
refresher will retrieve all tables and all views from schema S. UDTs (SQL
Server) and sequences/synonyms are always read from the targeted schemas. If
the database type supports catalogs, all schemas currently present in the
relational model data for that catalog are read. All catalogs in the project
of the database type to refresh are refreshed.
CliRefresher 7 0 c:\myprojects\myproject.llblgenproj CliRefresher /u:sa /p:topsecret 8 1 c:\projects\mytickettofortune.llblgenproj