Generate Persistance code straight
from your database.
FrameworkGen generates
simple, clean, performant code that can
easily be understood and extended.

Walkthrough - Getting Started

This walkthrough will take the process of generating code against a SQL Server database. This walkthrough assumes you have the Northwind database installed on your SQL Server Instance.

1. Start FrameworkGen. Complete the various fields. Specifying a 'Deployment Directory' will cause FrameworkGen to build the generated projects and deploy the dll's to the specified directory.

2. Press Ctrl + P or File --> Preferences. This will open the Preferences window.

The preferences window allows you to set various code generation options. Below are some of the options:

  • CreateStoredProcedures - Creates stored procedures in the database if it is set to true.
  • CreateUnitTests - When true generates an n-unit test project.
  • FrameworkVersion - Allows you to specify the .Net Framework version.
When you Save preferences you will be prompted as to whether you want the current settings to be made Global. Global settings are used for any newly created projects.

3. Clicking Next will take you to the Data Source tab. Here you can specify your SQL Server name and database settings.

4. Clicking Next will take you to the Table Selection tab. Here you can select which tables you want to generate code for.

5. Clicking Next will take you to the Table Sorting tab. By default generated stored procedures order the rows by the table primary key. This tab allows you to change the default sort for each table.
This can all be configured by right clicking on the Tree View items.

6. Clicking Next will take you to the Custom Queries tab. This tab allows you to build custom select queries which will in turn be created as stored procedures. This can all be configured by right clicking on the Tree View items.

When creating Custom Queries you will be presented with the window below. Here you can specify all of your filtering conditions.

7. Clicking Next will take you to the Transaction Groups tab. Here you can specify groups of tables you wish to be able to participate in a transaction. A new class will be generated for each group containing the various entities. A TransactionManager class will also be created in the BusinessComponents project. Updates can be performed by using this class.

8. Clicking Next will take you to the Existing Procedures tab. Here you can add existing stored procedures you would like to generate code for.

8. Clicking Next will take you to the Views tab. Here you can add views you would like to generate code for.

9. Clicking Next will take you to the Stored Procedures tab. Here you can select the stored procedures you would like FrameworkGen to create code for. If the CreateStoredProcedures preference has been set to 'True', stored procedures will be created in the database.

10. Clicking Next will take you to the Form Generation tab. Here you can select which administration web forms you would like to be created.

11. Clicking Generate will create the solution, projects and classes. When complete you will be shown the window below.

12. Clicking the 'Open Solution Folder' button will show you the window below in windows explorer. Click the 'Close' button. Then close FrameworkGen, you will be prompted to save your changes to a file.

Above you can see the various project folders and the solution file. There are also four batch files created:

  • Build.bat - Will build the solution.
  • Generate.bat - Will generate the solution again from the command line.
  • GenerateAndBuild.bat - Will generate the solution again from the command line and build it once complete.
Opening the solution file in Visual Studio will show you the following:

The solution items folder contains the following two useful files:

  • app.config - This file contains the various appSettings and connectionStrings you will need adding to your applications config file.
  • FrameworkGen.FrameworkGen - Contains the settings that were used to generate the solution, projects and classes.

Below is some code demonstrating how to use classes generated by FrameworkGen. Partial classes and interfaces will not be overwritten when a second generate is performed you can add any additional code into these classes.