| Key points: |
- All server-side code, wrapping the FoodAndDrinks database, was generated by WebORB, as shown in the prerequisite screencast.
- WebORB also generated client-side code, in the FAD_Client package of the client's src package, to provide the client-side interface to the server-side database (FoodAndDrinks).
- To add a new product to the database (see create.mxml):
- A new instance (product) of the class Product is created, and initialized from the user interface.
- (The Product class was generated by WebORB, to represent a record in the Product table in the server-side database.)
- A WebORB-generated method is called to add the newly-created product to the database:
- product.save(): Checks to see if an identical Product already exists in the database, and if so, updates it; else, creates a new record and adds it to the database.
- ActiveRecords.Product.create(product): Simply adds the product record to the database.
- When the new product has been added to the database:
- OnProductCreated() is called, which clears the application's user interface.
- Databinding (of productsGrid.dataprovider to _searchResult; see create.mxml, line 107) updates productsGrid to include the new product.
- Most of the action takes place in WebORB's runtime, and in Flex's data binding and responder mechanisms, rather than in application-specific code.
- Many of WDMF's patterns should be familiar to enterprise developers, if only from Martin Fowler's Patterns of Enterprise Application Architecture.
|