Compiling the generated code and setting up the solution.
In the previous tutorial, we generated sourcecode from an LLBLGen Pro project in the designer after having mapped some entities, a typed view and a retrieval stored procedure call.
In this tutorial, we'll open the generated Visual Studio projects in Visual Studio and compile the generated code and as well add a console project, setup the correct references so we can add our own code using the generated code to use the data in the Northwind database. This tutorial is divided into two sub tutorials: one for Adapter and one for SelfServicing.
Adapter: Setting up the Solution
Please follow the following steps to load the generated Visual Studio projects into Visual Studio, setting up the correct references, adding a console project and compile the whole solution. This part is for Adapter. If you're more interested in SelfServicing, see the SelfServicing section below.
- Start Visual Studio.
-
Select File -> Open -> Project / Solution or press
Ctrl-Shift-O
. The file browse dialog of Visual Studio opens. Browse to the folder into which you've generated the code, namely the folder you've specified for Destination root folder on the first tab of the code generation configuration dialog. The folder will contain two projects, Northwind.Tutorial.csproj (or vbproj if you've selected VB.NET instead) and Northwind.TutorialDBSpecific.csproj (or .vbproj). Select Northwind.Tutorial.csproj/vbproj and click Open. - Visual Studio has now created a solution for you and has loaded the database generic part of the Adapter sourcecode. We'll now load the database specific part as well. In Visual Studio's Solution Explorer, right-click the Solution node -> Add -> Existing project. Browse again to the Destination root folder and select Northwind.TutorialDBSpecific.csproj/vbproj and click Open.
- Visual Studio now has both the LLBLGen Pro generated Visual Studio projects loaded. By default, the generated projects should have the correct references setup.
-
Compile the sourcecode by pressing
Ctrl-Shift-B
. This should lead to a successful compilation. - For our next tutorial, we'll use a console application which will use the generated code. In the Solution Explorer, right-click the solution node -> Add -> New project. The new project dialog opens. For your language of choice, e.g. C# or VB.NET, select Console Application and specify for Name: NorthwindConsole and for Location the folder into which the generated code was generated, the folder you've specified for Destination root folder or a parent folder of that, e.g. C:\temp\NorthwindTutorial and click OK
- Visual Studio will now create a console application in our solution. In Solution Explorer right-click the NorthwindConsole project -> Set as startup project.
- If you're using C#, you have to setup the references in the Solution Explorer, if you're using VB.NET, you should open the Properties of the NorthwindConsole project and add the references there. For the NorthwindConsole project, add a reference to the SD.LLBLGen.Pro.ORMSupportClasses assembly. Do this by checking its checkbox in the Add references dialog under Assemblies -> Extensions. Also add references to both the Northwind.Tutorial and Northwind.TutorialDBSpecific projects.
-
LLBLGen Pro automatically generates an app.config file in the
DBSpecific project. We will use that one in our
NorthwindConsole project. In Solution Explorer expand the
Northwind.TutorialDBSpecific project's DatabaseSpecific folder and
select and drag the App.config file to the
NorthwindConsole project. Visual Studio will copy the file for us.
You can also copy the
connectionStrings
xml nodes of that app.config file into the app.config file of the console application.
You're now ready for the next tutorial where we will add code to our console application. Check the setup of the solution by compiling it with cntrl-shift-B and also save the solution to a folder, for example the parent of the folder you've specified with Destination root folder.
SelfServicing: Setting up the Solution
Please follow the following steps to load the generated Visual Studio projects into Visual Studio, setting up the correct references, adding a console project and compile the whole solution. This part is for SelfServicing.
- Start Visual Studio.
-
Select File -> Open -> Project / Solution or press
Ctrl-Shift-O
. The file browse dialog of Visual Studio opens. Browse to the folder into which you've generated the code, namely the folder you've specified for Destination root folder on the first tab of the code generation configuration dialog. The folder will contain one projects, Northwind.Tutorial.csproj (or vbproj if you've selected VB.NET instead). Select Northwind.Tutorial.csproj/vbproj and click Open. - Visual Studio has now created a solution for you and has loaded the database generic part of the Adapter sourcecode. By default, the generated project should have the correct references setup.
-
Compile the sourcecode by pressing
Ctrl-Shift-B
. This should lead to a successful compilation. - For our next tutorial, we'll use a console application which will use the generated code. In the Solution Explorer, right-click the solution node -> Add -> New project. The new project dialog opens. For your language of choice, e.g. C# or VB.NET, select Console Application and specify for Name: NorthwindConsole and for Location the folder into which the generated code was generated, the folder you've specified for Destination root folder or a parent folder of that, e.g. C:\temp\NorthwindTutorial and click OK
- Visual Studio will now create a console application in our solution. As Visual Studio isn't that bright to automatically make our console application the startup project, in Solution Explorer Right-click the NorthwindConsole project -> Set as startup project.
- If you're using C#, you've to setup the references in the Solution Explorer, if you're using VB.NET, you should open the Properties of the NorthwindConsole project and add the references there. For the NorthwindConsole project, add a reference to the SD.LLBLGen.Pro.ORMSupportClasses assembly. Do this by checking its checkbox in the Add references dialog under Assemblies -> Extensions. Also add a reference to the Northwind.Tutorial project.
- LLBLGen Pro automatically generates an app.config file in the SelfServicing project. We will use that one in our NorthwindConsole project. In Solution Explorer click open the Northwind.Tutorial project folder and select and drag the App.config file to the NorthwindConsole project. Visual Studio will copy the file for us.
You're now ready for the next tutorial where we will add code to our console application. Check the setup of the solution by compiling it with cntrl-shift-B and also save the solution to a folder, for example the parent of the folder you've specified with Destination root folder.