Rethinking Flex Data Management - part 3
This is part 3 in a series dedicated to the subject of Flex Data Management. In the first post I gave an overview of FDMS, the second part talked about some of the challenges and limitations associated with the FDMS approach. Now let's talk about WebORB Data Management for Flex (WDMF) - a new and innovative framework we have been working on. (WDMF will become available in the WebORB Professional/Enterprise distribution in late March/early April timeframe.)
What is WDMF? It is a new data management framework we are adding to WebORB. The framework is designed to do one thing extremely well - make developer lives easier creating data-driven Flex applications. Our to goal is to empower developers with tools and technologies so they can focus more on solving core application problems and less on writing integration or 'plumbing' code.
WebORB Data Management for Flex consists of:
- Design-time code generator integrated into the management console.
- Runtime data management framework. This is a set of APIs and events available on both client and server sides.
- Object relational mapping engine.

The code generator accepts a configurable data model which may consist of one or more data tables from one or more databases. Generated code includes a set of ActionScript v3 classes as well as all the supporting backend code. The framework includes rich support for all fundamental database operations (CRUD), as well as the ability to dynamically compose data retrieval queries using the dynamic method composition technique. The technique has been borrowed from the Ruby on Rails ActiveRecord pattern and elegantly adapted to the ActionScript environment.
The code generator automatically compiles and deploys the generated server code. The code for the client can be expanded from the generated ZIP into a Flex Builder project and immediately put to use. No additional configuration changes or custom coding tasks are required. The object model is very simple and intuitive. A row for every table from your data model is represented with a class. The class provides access to all basic data management operations. For example, consider the following table:

Among other classes supporting the framework, there is a generated ActionScript class representing a row from the Customers table would have the following structure:
public class Customer extends ActiveRecordThe class above and all its instances become the central point for any operation related to the Customers table. For instance, the APIs to perform customer searches, create new customer records, delete or modify existing records are accessible through the Customer class. Additionally, as a client makes a change or deletes a record, WDMF notifies all other clients in possession of the same record about the modification, thus realizing client synchronization.
{
public var CustomerID:int;
public var CompanyName:String;
public var ContactName:String;
public var ContactTitle:String;
public var Address:String;
public var City:String;
public var Region:String;
public var PostalCode:String;
public var Country:String;
public var Phone:String;
public var Fax:String;
}
The API to work with remote data is simple and very easy to use. For example:
retrieving a list of all customers:It is important to note that the operations shown above will automatically be propagated to all other connected clients which happen to contain the same Customer record. Additionally, none of these examples require any modifications in the generated server code. However, the server code establishes a very flexible framework support supporting a variety of customizations.
ActiveRecords.Customer.findAll();
retrieving a list of all customers from 'Tokyo":
ActiveRecords.Customer.findByCity( "Tokyo" );
retrieving a list of all customers from USA with the contact title as "Owner":
ActiveRecords.Customer.findByContactTitleAndCountry( "Owner", "USA" );
creating a new customer:
var newCustomer:Customer = new Customer();
newCustomer.CompanyName = "Acme Brick";
newCustomer.ContactName = "James Bond";
newCustomer.ContactTitle = "Chief Development Officer";
newCustomer.City = "Dallas";
newCustomer.save();
retrieving a record by primary key and deleting it:
var c:Customer = ActiveRecords.Customer.findByPrimaryKey( 123 );
c.remove();
There are a lot of cool features I plan to cover in the subsequent posts, including support for data binding, extensibility , transactions and security. Until then, check out the FAQ:
http://www.themidnightcoders.com/weborb/dotnet/wdmf-faq.shtm
Also, if you are attending the 360Flex conference, I will be demonstrating WDMF during my session next Monday between 4:00 and 5:20 in the Integration track.







2 Comments:
Mark, this looks amazing. No more need for PHP? Direct connection to MySQL?? How much easier can it get???
5:26 PM
That looks awesome. Please, if possible, record the event.
7:55 PM
Post a Comment
<< Home