0% found this document useful (0 votes)
58 views

Web Form Pages: Table of Contents

PDSAHaystackCh03-QuickStart-ASPNET

Uploaded by

Jason Hall
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Web Form Pages: Table of Contents

PDSAHaystackCh03-QuickStart-ASPNET

Uploaded by

Jason Hall
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 3

Quick Start - ASP.NET


Web Form Pages
Table of Contents
Chapter 3 ....................................................................................................................... 3-1
Quick Start - ASP.NET Web Form Pages...................................................................... 3-1
Quick Start for ASP.NET Web Form Applications .............................................. 3-1
Add New Project ................................................................................................ 3-2
Generate CRUD Classes for Tables .................................................................. 3-4
Table Information Screen ................................................................................... 3-4
Generate Table Data Classes ............................................................................ 3-5
Test Generated Classes and Web Form Pages ................................................ 3-7
Chapter Index................................................................................................... 3-14

Quick Start for ASP.NET Web Form


Applications
This document will describe how to start using Haystack for Code Generation to
quickly generate a working ASP.NET Web Form Application.

Quick Start - ASP.NET Web Form Pages


From your start menu locate the Haystack folder and click on the Haystack
Code Generator icon. This will start the Haystack Code Generator for .NET
(Figure 1).

Figure 1: Haystack Main Screen

After starting Haystack you will need to add a new Project. A project is used to
generate all objects from a SQL Server or Oracle database.

Add New Project


Click on the New button beneath the Project Info Name Combo Box (Figure 2)
to add a new project to Haystack.

3-2

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Add New Project

Figure 2: Click New to create a new Project

You will now be presented with the Project Information screen. On this screen
is where you will create the project that points to a database.

Figure 3: Project Information (Info Tab)

All you need to create a project is on this first tab (Figure 3). For this quick start,
just fill in a connection string to one of your databases, or if you installed the
Haystack Code Generator for .NET
Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-3

Quick Start - ASP.NET Web Form Pages


PDSASamples database when you installed Haystack, just leave this existing
connection string.
Click the Save button to save this new project into the Haystack database.

Generate CRUD Classes for Tables


After you have created a project and set the connection string to a valid server
and database/catalog, you are now ready to read in the list of tables in the
catalog or schema. Click on the Load Tables/Apply Filter button (Figure 4) to
load in all the tables.

Figure 4: Load Tables

After clicking the Load Tables/Apply Filter button the grid on the lower part of
the screen will be filled in with the names of the tables that match the filter.
At this point you need to click on the Info button to the left of a table to load all
of the columns for the table and display the Table Information Screen (Figure
5). You must open the table to load all columns in order to generate classes for
a table.

Table Information Screen


On this screen you may modify any of the SELECT, WHERE, ORDER BY,
INSERT, UPDATE or DELETE statements. You can read more about this
3-4

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Generate Table Data Classes


screen in another chapter. But to start all you have to do right now is to click on
the Save Table Info button. This will save all the columns for the table and all
the SELECT, WHERE, etc. statements into the Haystack database so that is
can now be generated.

Figure 5: Table Information Screen

Generate Table Data Classes


After saving the table information you will notice that the Generate check box is
now checked (Figure 6). You may now click on the Generate button to generate
the CRUD classes for the table selected.

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-5

Quick Start - ASP.NET Web Form Pages

Figure 6: Generate Code

You may then click on the Open Gen Folder button to view the classes that
have been generated.

3-6

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Test Generated Classes and Web Form Pages

Test Generated Classes and Web Form


Pages
Once the classes and Web Form Pages are generated you are ready to put
them into a project and try them out.
Open Visual Studio 2010 (or later).
Click on File | New | Project from the menu
Choose the Web Templates and click on the ASP.NET Web Application
template.
NOTE:

If you are using Visual Basic, you need to


name the WPF application the same name
you used in the Namespace in the Haystack
project you setup. This is normally
Sample.Project.

Browse to where you wish to save this project.


Click the OK button
Copy the BusinessClasses, DataClasses and EntityClasses folders from the
My Documents\Haystack\Gen folder as shown in Figure 7 into the root of your
new web application project.

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-7

Quick Start - ASP.NET Web Form Pages

Figure 7: Copy Business, Data and Entity Classes

Next drill into the \Gen\ASP.NET-WebForm-Pages folder.


Copy the entire contents of this folder (the ASP.NET Views and ViewModels
and Web.Config file) into the root of your new web application project (Figure
8). When prompted to overwrite the Web.Config file, choose Yes.

3-8

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Test Generated Classes and Web Form Pages

Figure 8: Copy ASP.NET Views and ViewModels and Web.Config file

Your Solution Explorer window in your Web application should now look like the
Figure 9:

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-9

Quick Start - ASP.NET Web Form Pages

Figure 9: Your Visual Studio project after adding generated code

You now need to add some resources to your ASP.NET web application in
order for the generated code to work.
From Haystack, click the Open | Install Folder for Resources menu as shown
in Figure 10.

Figure 10: Your Visual Studio project after adding generated code

Locate the folder named \_Resources-For-ASP.NET-WebForms (Figure 11).


Copy in the \Images folder into the root of your web project

3-10

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Test Generated Classes and Web Form Pages

Figure 11: Locate the resources to add to your Web application.

Now back in your Visual Studio web application right mouse click and choose
Add Reference from the context menu.
Click the Browse tab.
Navigate to the folder where you installed Haystack which is typically
C:\Program Files\Haystack or C:\Program Files (x86)\Haystack and under the
folder named \_Resources-For-ASP.NET-WebForms select all of the DLLs that
you find there and click the OK button as shown in Figure 12.

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-11

Quick Start - ASP.NET Web Form Pages

Figure 12: Reference the PDSA DLLs

Now within the \Views folder in your Visual Studio project, find one of the
generate views, right mouse click on and select Set As Start Page. Press F5 to
run the application and your new view should appear.
NOTE:

If you receive an error about a Namespace not


being found, this is normally because the
Namespace you created in the Project screen
in Haystack does not match the name of the
application you created. Simply perform a
search and replace on this name to fix this.

Congratulations! You created a complete List, Search, Add, Edit and Delete
page in just a matter of minutes.

3-12

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

Test Generated Classes and Web Form Pages

Summary
In this chapter you learned how to quickly generate CRUD classes and put
those classes into an ASP.NET project and test out the generated classes and
Web Form Pages.
NOTE:

The PDSA DLLs ONLY run in VS.NET when


you are using the DEMO version of Haystack.
In order to make them run from an .EXE file
you need to purchase the full version of
Haystack.

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

3-13

Quick Start - ASP.NET Web Form Pages

Chapter Index
A
Add New Project, 3-2

G
Generate Button, 3-5
Generate CRUD Classes for Tables, 3-4
Generate Table Data Classes, 3-5

I
Info Button, 3-4

L
Load Tables/Apply Filter Button, 3-4

Q
Quick Start for ASP.NET Web Form
Applications, 3-1

S
Save Table Info Button, 3-5

T
Table Information Screen, 3-4
Test Generated Classes and Web Form
Pages, 3-7
Tutorial for ASP.NET Web Form
Applications, 3-1

O
Open Gen Folder Button, 3-6

3-14

Haystack Code Generator for .NET


Copyright 2010-2011 by PDSA, Inc.
All rights reserved. Reproduction is strictly prohibited.

You might also like