DotNet Code Generator v2.0
DotNet Code Generator is a simple IDE that helps developers to generate running and completed full set of ASP.NET web application with powerful yet easy-to-use code generations tools with less effort and time just with few steps and settings.
Let’s see how to deal with application:
Registration - Trial Run Dialog:

To purchase DotNet Code Generator click on “Buy Software” button to redirect you to purchase URL, if want try program first click “Trial Run” button so you can run for 30 day or 20 time which exceeded first .
- Choose trial run to start work with program.

- Will see Program Main screen as following

- To create new project click File >> New Project

- Will open choose database dialog , write your Database you want to connect to values as following

- After choose Database you want generate project for it , program will browse all tables and views in this Database

- Now you can start choose tables and views you want to work on in generated .net project , let’s see example on simple Database [Students] which have two tables [Student] and [Course] with one-many relation , below script for this two tables if want try this sample:
--------------------------------------------------------------------------------------------
USE [Students]
GO
CREATE TABLE [Course](
[ID] [smallint] NOT NULL,
[Description] [nvarchar](100) NOT NULL,
[Price] [money] NOT NULL,
CONSTRAINT [PK_course] PRIMARY KEY CLUSTERED
(
[ID] ASC
)
) ON [PRIMARY]
GO
CREATE TABLE [Student](
[ID] [int] NOT NULL,
[Course] [smallint] NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Age] [int] NULL,
CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED
(
[ID] ASC
)
) ON [PRIMARY]
GO
ALTER TABLE [Student] WITH CHECK ADD CONSTRAINT [FK_Student_course] FOREIGN KEY([Course])
REFERENCES [Course] ([ID])
--------------------------------------------------------------------------------------------
- Let’s start work on course table , click on table in left tree and check , will see default tab Table Properties with following data

Table HTML Design section set common properties in HTML table (User Control Markup) as:
|
Table Header |
Text that will appear in HTML table Header. |
|
Table width |
HTML table width in pixels (px) or in ration (%). |
|
Controls Per Row |
“Control” word their means Label control and it’s entry control so one control per row will be one label and it’s control like following:
<tr> <td style="width: 100px"> <asp:label ID="lblDescription" runat="server" Text="Description :-"> </asp:label> </td>
<td style="width: 300px"> <asp:TextBox ID="txtDescription" runat="server" MaxLength = "100" Width = "90%" class=“txtStyle” TabIndex = "1"> </asp:TextBox> </td> </tr> Two controls per row mean two label and two data entry controls (label, Textbox, label, Textbox) and next label and control and so on.
|
|
Columns width |
Width of each columns or <TD> in ratio or in pixels as 100px:300px means first cell width in row 100px and second cell 300px that in case one control in row so label 100px and data control 300px, in case two controls in row must write four values as 10%:40%:10%:40% and so on, means for each control count write two width values |
|
Right to Left Layout |
Some languages need GUI design from right to left like Arabic language, so this check makes controls alignments from right to left |
Table DB & BOL properties set properties that effect in generation of Database stored procedures and generation of BOL file for selected table as:
|
Use Auto Increment column |
Indicate that if this table has ID column that will be incremented automatic by each insert operation in this table. |
|
Column Name |
if Use Auto Increment column checked so this DropDownList will fill by names of columns that can be incremented (as Primary Key column) , following is Auto Increment technique in generated stored procedures and BOL files: DotNet Code Generator create Table [AppIdentity] in database has all tables names that contains Auto Increment Column with columns name and last incremented values , so when insert new value in table have Auto Increment column next id get from Pre Defined stored procedure [GetNextID] get table name and return last incremented value + 1 for this column form [AppIdentity] table.
|
- Selected Table columns Tab:

From left tree that explore all database tables, click on table which want generate (BOL , stored procedures , user control , aspx page) for it , when click on table we will see all columns in this table , if we check the check box beside each column check box mean that column will be generated in user control for this table , also we can set a lot of properties for each generated column as we see in bottom of screen when we click on each column we can manage a lot of properties as following :
Control Basic Properties:
|
Column span |
if HTML table set to has more than on control per row, say two controls per row (control means label and entry control) so in two controls case we have four cells in row we can merge more than cell for entry control, default is one but can merge up to all cells in that row by change ColumnSpan to number of cells want to merge. |
|
ControlName |
Name for entry control detected from column name. |
|
ControlPrefix |
Prefix before control name say txt for textbox, ddl for DropDownList … so control name will be as txtPrice (control prefix+controlName). |
|
Control Type |
Type of entry control say asp: textbox, asp:DropDownList , custom:Calender ,….. |
|
Hidden field |
If set to true this column (control) will be asp hidden field (set and get value but not visible to user). |
Control Label Properties:
|
Label Name |
Text that will set for label control name, by default will be lbl+ColumnName. |
|
Label Text |
Text that will set for label control text by default will be ColumnName: - . |
|
Label Type |
Type for control that will be before entry control, by default asp:label control. |
Misc:
Extra properties changes according to selected control type, for example:
Textbox:-
|
Max Length |
Max length for characters can write in textbox control, by default get from database column max length in database. |
|
Tab Index |
tab index for control in design , by default ‘1’ if all control tab index in user control is ‘1’ so when user press tab button will navigate with correct controls order in page. |
|
Text |
Default text for text box control, be default empty. |
|
ValidationGroup |
If want apply validation on set of controls in one group so write validation group name. |
|
Width |
width of control in design, by default 90% of cell which this control in. |
DropDownList:
In our sample let’s take example CourseID column in student table to be DropDownList to be have all available courses in student screen till can choose from them, let see DropDownList control default properties:
|
DataSource |
Name of table to load lookup data from ([course]). |
|
DataValueField |
Name of column that have value to bind from lookup table ([course].[ID]). |
|
DataTextField |
Name of column that have value to bind from lookup table ([course].[Description]). |
|
CssClass |
if use css class for DropDownList set its name |
|
TabIndex |
tab index for this control in page when user press tab button by navigate between controls by keyboard , if let tab index for all controls as its default ‘1’ controls will be arranged automatically by their order in page |
|
ValidationGroup |
if this control belong to special validation group write it’s name |
|
AutoPostBack |
If this DropDownList have to postback page when user change its select value so set to true else let as its default false. |
- GUI Section:
Press on GUI tab to see like following screen:

- To add new aspx page right click on pages node then click New Page

- by default new page named to default.aspx , you can right click on it to rename to name you want.

- Now you create new aspx page in your project with default properties which you can edit in [ASPX Page Properties] tab in right of screen.

- to add any from available user controls above to new added ASPX page just drag and drop User Control (say Courses) to page node which you want to add user control to it (say Page_Cources.aspx).

- Now we do basic steps to generate asp.net project, let’s press F5 or Generation >> Start Generation menu item to start generation:

Will see generation options as following:

Saving Options:
|
Generate BOL |
Generate Business Object Layer Classes for selected tables. |
|
Generate Common DAL Files |
Generate Data Access Layer classes its common shared files used by all BOL classes. |
|
Run Database Stored Procedures |
Generate and run database stored procedures against project database for each selected tables (INSERT- UPDATE-DELETE). |
|
Generate Design and Code behind Files |
Generate User Controls (.ascx files), Code Behind for User Controls (.ascx.cs files), Generate Web Pages (.aspx files), Code Behind for Web Pages (.aspx.cs files). |
BOL Generation Options:
|
Save Methods |
Generate only save method and stored procedure and when save check if record exist before so act as update else if first insertion for record so act as insert. |
|
Insert and Update Methods |
Generate two methods and two stored procedures insert and update additionally generate save method in BOL to check if record exist so call update method else if new record so call insert method. |
|
BOL Namespace |
Default name for all generated BOL files to call all BOL file from same namespace. |
|
DB Stored Procedures Prefix |
Preferred prefix before stored procedures name in Database and BOL files. |
|
Code Language |
Can generate code in C# or VB.NET language according to checked language. |
|
Generate DLL |
user have option to Generate DAL files and BOL files as source code files or as a compiled dll files referenced in project , to generate as DLL just check Compile to DLL check. |
- Can create new solution , project for this database by check Create in New Solution check and write project name or in un-check so append to existing project files
- Advanced options:
DotNet Code Generator work based on editable templates user can change according to user needs and standers as following:
- Database types mapping:


This is default template and user can edit in this template as needed.
|
Type From |
Database type name (column type). |
|
To |
asp control that database type map to, can by any custom control also as cus:MyTextBox |
|
Prefix |
Default prefix for that control to use before each control name of this type say column StudentName when map by default to textbox be txtStudentName. |
|
Label Type |
Type of control that act as label before entry control, by default asp: label. |
|
LabelTextTerminator |
Terminator that appended to label text as Text: - , text: ,text-, and so on , can leave empty. |
|
SmartLabelTextDetection |
In label text that display to user try to detect best text can display to user for example if column name is StudentName text will Student Name:- (without space) , if column name is Student_Name text will Student Name:- (without _) , as so on. |
|
Class |
If there is CSS class for labels write it. |
|
Lookup_control Type |
Name of control that used to load lookup data, default in DropDownList. |
|
Prefix |
Prefix that will write before lookup control say if column name CourseID so control name will be ddlCourseID. |
|
AutoDetectFromForignKey |
If column in database is Foreign Key set it by default as lookup control. |
Server Control Settings: user can determine witch controls working on and witch properties for each control and its defaults, to add controls or edit control properties as following:


As in template there is by default four controls, controls name write ControlAssemblyControlType as aspTextBox (without :), then control properties with its names and type in asp.net markup.