In the last post we saw how easy it is to reverse engineer a database schema. Let's now use the resulting persistent classes library to build the first website.
Let's do it again step by step:
Step 1: Use the resulting solution from the northwind reverse engineering post.
Step 2: Add a new web application by execution File->Add->New Web Site... from the Visual Studio Menu. Choose ASP.NET Web Site.
Step 3: Add a reference from the website to the class library. Select the website project in the Solution Explorer and execute Website->Add reference from the Visual Studio Menu. Select the class library project in the Projects tab.
All OpenAccess binding controls can open and manage the database by themselves. They only need a helper class that holds the code for database access. This class can be generated from the OpenAccess Enable Project Wizard. You can place this class directly in the persistent classes library or in a separate Data Access Layer assembly.
Step 4: Add the OpenAccess helper class to the persistent classes library. Select the class library project in the Solution Explorer and execute OpenAccess->Enable Project. Keep everything as it is, only on the second page check the 'Data Access code' checkbox.
Step 5: Compile everything so that the web page designers can work.
Now you have a perfect project for designing some ASP.NET pages as you are always doing.
Step 6: Drag and drop the grid of your choice to the default.aspx file. Open the controls context menu. Select '<New data source>' from the controls 'Choose Data Source' combobox. Choose the OpenAccessDataSource which starts the wizard.
Dialog 1: Choose the helper class you did generate and press Next.
Dialog 2: Select the type that you want to bind to the grid. In our case let's choose Order. And press Finish
Step 7: We are done and you can start your application.
You can now start to design your web pages as you always do.