Getting started
You can generate a complete PLINQO for NHibernate solution from your database in three steps. To add PLINQO NH to a project you already have, see Add PLINQO NH to an existing project.
Step 1: Install CodeSmith Generator
Download and install CodeSmith Generator.
Note
If you don't own a Generator license, register on the CodeSmith Tools website to get a trial key.
Step 2: Download PLINQO NH
PLINQO NH isn't installed with Generator. Download it from GitHub:
- Download
PLINQO-NHibernate-1.3.zipfrom the PLINQO for NHibernate 1.3 release. - Unblock the
.zipfile before you extract it. - Extract it into its own folder under
Documents\CodeSmith Generator\Templates, for exampleDocuments\CodeSmith Generator\Templates\PLINQO-NH. Template Explorer showsDocuments\CodeSmith Generator\Templatesas My Templates. - Open Template Explorer, and open the folder you extracted PLINQO NH into.
Step 3: Run the QuickStart
- Double-click
QuickStart.cstto execute the template. - Select a database in the SourceDatabase property.
- Click Generate.
The QuickStart creates a Visual Studio solution and opens it in Visual Studio. Build the solution to generate the PLINQO NH code.
Add PLINQO NH to an existing project
-
In Visual Studio, create a project or open the project you want to add the NHibernate files to.
-
Add a Generator project file (
.csp) to the project: in Solution Explorer, right-click the project, select Add > New Item, and add a Generator Project from the CodeSmith Generator category. See Using a Generator project inside Visual Studio. -
Right-click the
.cspfile and select Manage Outputs. Add these outputs, in this order, and fill in their required properties:Template Required properties Hbms.cst SourceDatabase,AssemblyNameEntities.cst SourceDatabase,AssemblyNameQueries.cst SourceDatabase -
Add a connection string to your
App.configorWeb.configfile. The generated code uses the first connection string whose name containshibernateor the name of your database (not case-sensitive), so name itnhibernate, for example. -
Right-click the
.cspfile and select Generate Outputs. -
Build the project.