Generate source code

In this tutorial, we'll use your project to generate source code from it so we can use the mapped elements in our own programs.

Configuring and generating source code

Please follow the following steps to generate sourcecode from the project we've created in the previous tutorial. This tutorial will be for C# and will generate .NET 4.5.2 code. If you're more into VB.NET, you should select VB.NET instead of C#.

  • Start the LLBLGen Pro designer. Either use the Programs start menu, Windows search or double click the LLBLGenPro.exe in the installation folder to start the LLBLGen Pro designer.
  • To open our tutorial project, select it from the Recent Projects list on the Home Tab, or select File -> Open Project... from the main menu, or select the project from the File -> Recent Projects... menu.
  • To generate code, either press F7, or select the menu option Project -> Generate Source-code... The Generate Code dialog opens.
  • As we have just one model in the project, it will show one task, for the Entity Model. As this isn't the first we're generating code, it's a valid task and you can proceed with generating the code. If you want to change aspects of the code generation task, you can edit it here by clicking the Edit Selected Task Specifics button. The Code Generation Task Configuration dialog opens.
    • By default the view is the 'Simple' view, with just 1 tab. On this tab, General Settings, select either C# of VB.NET for Target language and select the .NET version of your choice in the Target Platform drop-down.
    • For Root namespace, specify Northwind.Tutorial
    • There's just one template group for NHibernate so leave it at 'General'.
    • There are four presets for NHibernate v4, select the default one, SD.NHibernate (Fluent NHibernate and classes).
    • For Destination root folder under Code file parameters you should specify a folder into which you want to generate the code. For this tutorial we'll use c:\temp\NorthwindTutorial\DAL
    • Click OK to close the configuration dialog.
  • We're now done setting everything up. LLBLGen Pro will store your settings in the project file after code generation so you don't have to set things up the next time you're generating code. Click Perform Tasks... to generate the sourcecode into the Destination root folder.