Friday, 22 June 2007

In my previous installment, I wrote about using the Database Reverse Engineering Wizard to create classes and mappings for an existing database.  In today's post, I talk about using the Genome Web Application Wizard to create a simple, yet fully functional ASP.NET Site to view and edit entries in your database.

I'm basically continuing where I left off last time.  I have a Visual Studio Solution with two projects: one with the DataDomain classes, and one with the mapping files.  Now I add a new project using File -> Add -> New Project ...  I select Visual C# (the Wizard seems to be a C#-only affair), and then Genome Web Application.

I gve the project a name, and click OK.  I click Next on the Wizard's Welcome page, and come to the page where I select the DataDomain Schema (or Mapping) project, and the Business Project.  The Wizard is smart enough to automatically detect the appropriate projects in the solution.

Next once more, I enter the connection string again, click Finish and Finish again.  I now have a third project in my solution, with appropriate references, CSS adapaters, a default page, a master page and a couple of helper classes.

At this point, I made the mistake of thinking that the wizard had malfunctioned because there are no pages for my business objects.  There's only a default.aspx page, and that one is empty.  One of my colleagues kindly explained to me that I need to add those pages manually.  That way, I can specify exactly what such a page should contain.

So I right-click the web application project, point to Add and select New Item.  There are two Genome-related items to choose from, the Genome Details Page and the Genome List Page. I select Genome List Page and call it Orders.aspx.

I click on Add, and another part of the wizard appears.  I click Next to get past the welcome screen, I choose my business object class (Order) and click next again. A screen with several settings appears.  I leave the default values, except that I enable in-place editing.  I click Finish twice and the wizards adds Orders.aspx to the web application.

I set Orders.aspx as the project's start page and hit F5.  A browser window opens and I see a page with filter options and the results of the search.  Go ahead and play around with the filter options.  The Edit and Delete links are fully functional as well.  Play around with these as well.  Show Details leads to an HTML 404 error however, since we haven't yet defined a details page for the Order business entity.  I close the browser and return to Visual Studio.

I add another item to the web application, but this time I select a Genome Details Page.  I click through the wizard, select Order for my business class and basically accept all the default values.  The wizard adds an OrderDetails.aspx page to the project. I hit F5 again, and the Orders.aspx page opens again.  I click on Show Detail for one of the items, and this time OderDetails.aspx opens and shows the details of the Order object.

You can repeat this process for all business entities that you want to view and edit in the web application.  Using the Genome Web Application wizard, you can quickly generate a small but fully functional web site for editing your business data.

In the next installment, I will show how to create a Windows Forms application that uses Genome.

Posted by Dirk

Technorati Tags: object relational, getting started

Friday, 22 June 2007 09:50:56 (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |