Generating Code for NHibernate

Before generating code for NHibernate, you must have NHibernate 1.0.2 or higher installed.

  1. Select Tools > Check Model to verify if there are errors or warnings in the model. If there are errors, fix them before continuing with code generation.
  2. Select Tools > General Options, and click the Variables node.


  3. Add a variable NHIBERNATE_HOME and, in the value field, enter the NHibernate home directory path. For example, D:\nhibernate-1.0.2.0\bin.
  4. Select Language > Generate C# 2 or Generate Visual Basic 2005 Code to open the Generation dialog box:
  5. Specify the root directory where you want to generate the code, and then click the Options tab:


  6. [optional] To use DAL, set the Generate DAL sources option to true. For information about the standard C# and VB.NET generation options, see the relevant chapters.
  7. Click OK to generate code immediately or Apply and then Cancel to save your changes for later.

Once generation is complete, you can use an IDE such as Visual Studio.NET 2005 to modify the code, compile, and develop your application.