http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/petshop3x.asp
Gregory Leake
Microsoft Corporation
James Duff
Vertigo Software, Inc.
May 2003
Applies to:
Microsoft® .NET Framework 1.0 and 1.1
Microsoft® Windows 2000 and Windows Server™ 2003
Microsoft® Internet Information Services
Microsoft® SQL Server™ 2000
Oracle® 9i Database
Summary: Version 3.x of the .NET Pet Shop addresses the valuable feedback given by reviewers of the .NET Pet Shop 2.0 and was created to ensure that the application is aligned with the architecture guideline documents being produced by the Microsoft. (20 printed pages)
Download the Pet Shop 3.0 Installer.msi code sample.
Abstract
What is the Java Pet Store?
Microsoft .NET Pet Shop
Business Requirements
Application Data Model
.NET Pet Shop 2.0 Architecture
.NET Pet Shop 3.0 Architecture
Conclusions
Appendix A: Changes between Versions 2 and 3
The purpose of the original .NET Pet Shop study was to take Sun's primary J2EE blueprint application, the Sun Java Pet Store, and implement the same application functionality with Microsoft .NET. Based on the .NET implementation of Sun's J2EE best-practice sample application, customers can directly compare Microsoft's .NET technology to J2EE-based application servers across a variety of fronts while learning about the similarities and differences in the recommended design patterns for building Web-based applications. The .NET Pet Shop application is now in its third revision and is designed to show the .NET best practices for building enterprise n-tier applications which may need to support a variety of database platforms and deployment models. The .NET Pet Shop 3.0 has been re-architected based on community feedback on the .Net Pet Shop 2.0 to comply with Microsoft's Prescriptive Architecture Guidance as published on MSDN. The third revision is also fully compliant with the Middleware Company Application Server Benchmark Specification, and will serve as Microsoft's entry in the upcoming Middleware Application Server Benchmark this spring: a second round of testing by the Middleware Company to compare the scalability of .NET and the J2EE platforms for building and hosting enterprise Web applications.
The Java Pet Store is a reference implementation of a distributed application according to the J2EE blueprints maintained by Sun. The sample application was originally created to help developers and architects understand how to use and leverage J2EE technologies, and how each of the J2EE platform components fit together. The Java Pet Store demo includes documentation, full source code for the Enterprise Java Beans (EJB) architecture, Java Server Pages (JSP) technology, tag libraries, and servlets that build the application. In addition, the Java Pet Store blueprint application demonstrates certain models and design patterns through specific examples.
The full Java Pet Store contains three sample applications:
The original version of the Java Pet Store was designed to work with the following databases: Oracle, Sybase, and Cloudscape. IBM has created a DB2 port of the application. The application is publicly available at the Java 2 Platform Enterprise Edition Blueprints. The premise of the main application, the Java Pet Store, is an e-commerce application where you can buy pets online. When you start the application you can browse and search for various types of pet from dogs to reptiles.
A typical session using the Java Pet Store would be:
Homepage—This is the main page that loads when the user first starts the application.
Category View—There are five top-level categories: Fish, Dogs, Reptiles, Cats, and Birds. Each category has several products associated to it. If we select Fish as the category, we might see "Angelfish" etc.
Products—If you now select a product the application will display all variants of the product. Typically the product variant is either male or female.
Product Details—Each product variant (represented as items) will have a detailed view that displays the product description, a product image, price, and the quantity in stock.
Shopping Cart—This allows the user to manipulate the shopping cart (add, remove, and update line items).
Checkout—The checkout page displays the shopping cart in a read-only view.
Login Redirect—When the user selects "Continue" on the checkout page, they are redirected to login page if they have not signed in yet.
Verify Sign In—After being authenticated onto the site, the user is then redirected to the credit card and billing address form.
Confirm Order—The billing and the shipping addresses are displayed.
Commit Order—This is the final step in the order-processing pipeline. The order is now committed to the database at this point.
Figure 1. Java Pet Store
The goal of the .NET Pet Shop was to focus solely on the Java Pet Store (the administration and mailer component were not implemented in .NET). In addition to reproducing the functionality of the Java Pet Store application, two additional objectives were added:
Figure 2. .NET Pet Shop
The overall logical architecture of the .NET Pet Shop is given in Figure 3. The main focus of the design was to use ASP.NET Web Forms for the presentation tier which communicate to C# business components in a logical middle tier. In turn the business components access a back end database through ADO.NET and a SQL Server helper class known as the Data Access Application Block (DAAB) for more information on the DAAB and to download the full DAAB source code. Data Access is fully abstracted into a Data Access Layer (DAL), separate from the business logic layer (BLL). New with the .NET Pet Shop 3.0, we have introduced a DAL layer for both Oracle 9i and SQL Server 2000 databases. Class loading of the appropriate DAL layer occurs dynamically at runtime based on an application configuration setting in Web.Config. Note that .NET Pet Shop 3.0 uses two backend databases, and the order process involves a distributed transaction across these two databases. Using simple Web.Config application settings, users can deploy the .Net Pet Shop to work with sing