![]() |
![]() |
![]() |
![]() |
|
The enclosed study takes the Microsoft implementation of Sun's primary J2EE
blueprint application , the Sun Java Pet Store and implements the same
functionality using the AgileStudio addin for Visual Studio.NET.
Additional functionality has been added to the application in particular data
driven menus, administration screens, enhanced validation and calculations, to
demonstrate the programming efficiency gained using AgileStudio. Even with all
this additional functionality, the total lines of manual code required to
produce the AgileStudio Pet Shop benchmark has been reduced by 90% to a
remarkable 206 lines across all tiers.
AgileStudio does not have any built in support for shopping
carts. The enclosed Pet Shop benchmark is built using AgileStudio general
functionality for building Windows and Web applications. AgileStudio
handles a lot of routine tasks like the building of DataSets and Stored Procs
and the binding of user interface controls. This allows developers to
concentrate almost exclusively on application domain specific code.
The above Trademarks and those referred to in this document are the property of
their respective owners
The Pet Shop benchmark provides an ideal opportunity to showcase the powerful
general functionality of AgileStudio to accelerates the development of Windows
and Web data driven applications. The application project includes 22
Web Pages, 5 Web Controls and 22 Typed DataSets and encompasses a wide range of
functionality. 12 AgileStudio Objects are used to automatically generate 14
SqlServer tables and numerous Stored Procedures. Try out the hosted demo of the
AgileStudio Pet Shop application
here.
Here the DataStore manager is linked directly into the application. It can also
be installed as a seperate service where this is appropriate.
You can also Download a 30 day
trial of the AgileStudio addin for Visual Studio.NET 2003 and install the Pet
Shop sample.
In this document we detail the structure of the AgileStudio Pet Shop
application and outline some of the features used to accelerate the development
process.
The basic functions of the Pet Shop Application.
(Additional features added to the Pet Shop application are detailed in
Section 9 )
A typical session using the Pet Shop may involve:
AgileStudio is a tightly integrated addin which extends Visual Studio.NET to
accelerate the development of Windows and Web Database Applications. See the
sample Walkthroughs (No
Download Required), for step by step building of such applications
AgileStudio:
AgileStudio employs a high level abstract object model which is
sufficiently expressive to describe complex real world situations. The model
allows for objects to be both internally hierarchical and also have the
ability to refer to each other relationally. The object model is
constructed using only items that appear in the real business world, without
showing any underlying plumbing required by a specific data store
implementation. The data situation is modeled with 4 basic elements - Objects,
Items, Lists and Links.
The AgileStudio Pet Shop application makes use of a number of Views that
are specified for an Object. AgileStudio Views can be used to build fixed
reports or reports that have parameters determined at runtime. These Views can
be easily and quickly modified through the View Collection Editor without
requiring hand coding.
AgileStudio works with standard Windows or Web Projects and your choice
of managed language. The AutoBind ToolBox Tab provides a set of Controls that
are specific to the currently selected Object Item and the currently active
Form. When a Control is dropped on the form, binding of the most commonly used
properties to the DataSet is handled automatically for both simple and complex
bindings.
AgileStudio automatically manages:
Below are some of the efficient and powerful AgileStudio features employed while developing the Pet Shop Application.
private void agilepagesDataSetManager1_AfterPerformAction(object sender,
Sekos.Data.AgilepagesClient.AfterActionEventArgs args)
{
#region hand-coded
if (args.Action=="Save")
{
string cartId= this.Request.Cookies["CartId"].Value;
this.Response.Cookies["CartId"].Value= "";
this.Response.Redirect("Order.aspx?id="+cartId,true);
}
#endregion hand-coded
}
The diagram below details the Object model for AgileStudio Pet Shop benchmark.
The diagram below details the page navigation that would occur in a typical user session.
The original Microsoft .NET Pet Shop has been expanded to demonstrate the efficency of using AgileStudio to produce a complete working application with only a few extra lines of domain specific code. This application, like all applications developed using AgileStudio, is fully open and extensible.
The Pet Shop benchmark provided an ideal way to demonstrate the efficiencies
gained by using the AgileStudio Addin for VisualStudio.NET. Although Pet Shop
is essentially a shopping cart application it encompasses a wide range of
functionality used across all data management applications.
As demonstrated AgileStudio automates a wide range of routine tasks freeing
developers to concentrate on domain specific code. Even with a wide range of
additional functionality, there was a 90% reduction in the lines of
manual code required to implement the Pet Shop benchmark.
The demo version of the AgileStudio benchmark application is available
here.
You can also Download a 30 day
trial of the AgileStudio addin for Visual Studio.NET 2003 and examine the
AgileStudio Pet Shop sample in detail.
The following stored procs are automatically generated to service the UI. Each Stored Proc is automatically generated to serve only the data required for the controls on the form. This may include data (both simple and calculated) from multiple tables while excluding any data not required by the form. A sample Stored Proc is shown below. The full list of Stored Procs produced automatically for the Pet Shop application is detailed here.
The SQL Server Tables along with all Keys, Indexes, Relationships and Constraints are automatically generated by AgileStudio. Modifying the Object schemas will cause the database to be updated automatically.
The domain specific code required to produce the AgileStudio Pet Shop benchmark application is detailed here.
DECLARE @lastid_Order int -- Set up temporary tables for ids and errors DECLARE @lastid_Order_CreditCardType int DECLARE @ids TABLE ( TableName varchar(255), Id int, OriginalId int ) DECLARE @errs TABLE ( Id int, ParentItemName varchar(255), ItemName varchar(255), Error varchar(255), CurrentValue varchar(255) ) SET ROWCOUNT 0 -- Flag an error for any item that has been changed by another user or task while the form was being edited INSERT @errs SELECT pk_id as Id,'Order' as ParentItemName,'CreditCardType' as ItemName,'#1' as Error,ap_CreditCardType as CurrentValue from ap_Order WHERE pk_id = 194 and ap_CreditCardType!='0' and ap_CreditCardType!='1' UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'CreditCardNumber' as ItemName,'#1' as Error,ap_CreditCardNumber as CurrentValue from ap_Order WHERE pk_id = 194 and ap_CreditCardNumber IS NOT NULL and ap_CreditCardNumber!='12345678901234' UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'CreditCardExpiryYear' as ItemName,'#1' as Error,ap_CreditCardExpiryYear as CurrentValue from ap_Order WHERE pk_id = 194 and ap_CreditCardExpiryYear!=NULL and ap_CreditCardExpiryYear!=2006 UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'OrderDate' as ItemName,'#1' as Error,ap_OrderDate as CurrentValue from ap_Order WHERE pk_id = 194 and ap_OrderDate IS NOT NULL and ap_OrderDate!=CONVERT(datetime,'2005-06-08',120) UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'OrderStatus' as ItemName,'#1' as Error,ap_OrderStatus as CurrentValue from ap_Order WHERE pk_id = 194 and ap_OrderStatus!='1' and ap_OrderStatus!='2' UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'User' as ItemName,'#1' as Error,ap_User as CurrentValue from ap_Order WHERE pk_id = 194 and ap_User!='0' and ap_User!='1' UNION ALL SELECT pk_id as Id,'Order' as ParentItemName,'CreditCardExpiryMonth' as ItemName,'#1' as Error,ap_CreditCardExpiryMonth as CurrentValue from ap_Order WHERE pk_id = 194 and ap_CreditCardExpiryMonth!=NULL and ap_CreditCardExpiryMonth!=12 -- Continue if no errors have occured so far IF @@ROWCOUNT=0 BEGIN -- Do the updates for data entered in Checkout3.aspx UPDATE ap_Order SET ap_CreditCardType = 1 , ap_CreditCardNumber = '12345678901234' , ap_CreditCardExpiryYear = 2006 , ap_OrderDate = CONVERT(datetime,'2005-06-08',120) , ap_OrderStatus = 2 , ap_User = 1 , ap_CreditCardExpiryMonth = 12 WHERE pk_id=194 SET @lastid_Order = 194 INSERT @ids values('ap_Order',194,194) -- Do the updates corresponding to any actions that may have been defined for this object UPDATE ap_User SET ap_FirstName= ap_Order.ap_BillFirstName,ap_LastName= ap_Order.ap_BillLastName, ap_Address1= ap_Order.ap_BillAddress1,ap_Address2= ap_Order.ap_BillAddress2,ap_City= ap_Order.ap_BillCity, ap_State= ap_Order.ap_BillState,ap_PostalCode= ap_Order.ap_BillPostalCode,ap_Province= ap_Order.ap_BillProvince, ap_Country= ap_Order.ap_BillCountry FROM ap_Order WHERE ap_Order.pk_id=@lastid_Order AND ap_Order.ap_User=ap_User.pk_id UPDATE ap_Product_Items SET ap_QuantityInStock= (select ap_Product_Items.ap_QuantityInStock from ap_Product_Items where ap_Product_Items.pk_id=ap_Order_Items.ap_ProductItems)- ap_Order_Items.ap_Quantity FROM ap_Order_Items WHERE ap_Order_Items.fk_Order=@lastid_Order AND ap_Order_Items.ap_ProductItems=ap_Product_Items.pk_id -- Finally do any other validation- In this case two custom validations INSERT @errs SELECT OriginalId as Id,'Order' as ParentItemName,'CreditCardNumber' as ItemName,'Credit Card Number should contain 16 digits and no spaces ' as Error,null as CurrentValue from ap_Order,@ids where pk_id=Id and TableName='ap_Order' and not(LEN( ap_Order.ap_CreditCardNumber )=16 AND PATINDEX('%[^0-9]%', ap_Order.ap_CreditCardNumber)=0) INSERT @errs SELECT OriginalId as Id,'Order' as ParentItemName,'CreditCardExpiryYear' as ItemName,'The month should be from 1 to 12, the year from 2005 to 2010 so the Expiry date next month or later.' as Error,null as CurrentValue from ap_Order,@ids where pk_id=Id and TableName='ap_Order' and not( ap_Order.ap_CreditCardExpiryMonth>=1 AND ap_Order.ap_CreditCardExpiryMonth<=12 AND ap_Order.ap_CreditCardExpiryYear>=2005 AND ap_Order.ap_CreditCardExpiryYear<=2010 AND (ap_Order.ap_CreditCardExpiryYear>YEAR(GETDATE()) OR ( ap_Order.ap_CreditCardExpiryYear=YEAR(GETDATE()) AND ap_Order.ap_CreditCardExpiryMonth>MONTH(GETDATE())))) END SELECT * from @errs SELECT @lastid_Order
The application consisting of 22 Web Pages, 5 Web controls and 22 Typed DataSets.