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:

  1. Download PLINQO-NHibernate-1.3.zip from the PLINQO for NHibernate 1.3 release.
  2. Unblock the .zip file before you extract it.
  3. Extract it into its own folder under Documents\CodeSmith Generator\Templates, for example Documents\CodeSmith Generator\Templates\PLINQO-NH. Template Explorer shows Documents\CodeSmith Generator\Templates as My Templates.
  4. Open Template Explorer, and open the folder you extracted PLINQO NH into.

Step 3: Run the QuickStart

  1. Double-click QuickStart.cst to execute the template.
  2. Select a database in the SourceDatabase property.
  3. 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

  1. In Visual Studio, create a project or open the project you want to add the NHibernate files to.

  2. 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.

  3. Right-click the .csp file and select Manage Outputs. Add these outputs, in this order, and fill in their required properties:

    Template Required properties
    Hbms.cst SourceDatabase, AssemblyName
    Entities.cst SourceDatabase, AssemblyName
    Queries.cst SourceDatabase
  4. Add a connection string to your App.config or Web.config file. The generated code uses the first connection string whose name contains hibernate or the name of your database (not case-sensitive), so name it nhibernate, for example.

  5. Right-click the .csp file and select Generate Outputs.

  6. Build the project.