Tutorial: Adding code to the console application, SelfServicing

Preface

In the previous tutorial, we set up VS.NET 2005 to have our generated sourcecode in one solution, have the right references and we added a console application project, NorthwindConsole. That last project is our target for this tutorial: we'll add some code to that project so you can see the generated code in action! This tutorial is SelfServicing specific. If you've generated Adapter code instead, please use the Adapter variant of this tutorial.

The main goal of this tutorial is to show you how to get a complete solution setup and where to add your own code to utilize the LLBLGen Pro generated code so you can for example connect to the database, read some entities, manipulate them and save their changes. The LLBLGen Pro manual contains a lot of small different code snippets which illustrate the many different features of LLBLGen Pro's runtime library and generated code. With this tutorial you'll learn a starting point where to test these snippets out.

Using the generated code

Setting up the using / Imports statements
Before we will continue, we'll setup the using / Imports statements at the top of the Program.cs/ Module1.vb file.

Using Entities
In the first tutorial you've mapped a couple of different elements to database elements: entities, a typed view and a retrieval stored procedure. In this part of the tutorial we'll utilize the entities. First we'll fetch a subset of the entities and display them in the console. After that we'll manipulate them and save the changes.

Using Typed Views
We'll leave the land of Entities for now and will instead look at how to use the Typed View we've mapped, Invoices. This Typed View is mapped onto the database view 'Invoices' and initially it will return over 2000 rows. We'll create a Windows Forms form and bind the 2nd page of 25 rows of the Typed View Invoices to a grid on the form.

Using Retrieval Stored Procecure Calls
We also mapped a retrieval stored procedure call, SalesByYear. This stored procedure accepts two dates and will return the list of orders which have their ShippedDate between the two specified dates. In the next few steps we'll call this SalesByYear procedure and will show its results in the Viewer we've created in the Using Typed Views section above. If you haven't followed that section yet, at least create the viewer class as illustrated there.


LLBLGen Pro v2.6 documentation. ©2002-2008 Solutions Design