It is a really long day today:-) I’m now still listening to "24 Hours of Delphi" online webinar hosted by David I and Anders Ohlsson from Developer Relations, and it is almost midnight now. Very good stuff!
I have promised during my session to upload "FireMonkey End-to-End Scenarios" demos. Both demos and slides are now available for download from this link: http://cc.embarcadero.com/item/28674
With FireMonkey you can create great looking HD and 3D user interfaces, but at the end, in enterprise applications, it is all about data. How data is accessed and how changes to data are persisted. FireMonkey applications can use different strategies to persist data. For example they can use local storage, remote relational database, SOAP web services server or DataSnap server. In all scenarios the user interface and data objects are the same. The data in a FireMonkey application is stored in a "TClientDataSet" component with some test "employee" data. This data is manipulated using "TStringGrid" and "TBindNavigator" visual components, which are connected to the client dataset using LiveBindings "TBindDBGridLink". Different scenarios show different ways of persisting data stored in the application.
Scenario 1: Local Storage
In this scenario we use TClientDataSet methods to persist data in a local file. There are two buttons in the user interface that call "SaveToFile" and "LoadFromFile" methods to update and refresh data.
Scenario 2: RDBMS client
In this scenario the client dataset component is connected to a "TDataSetProvider" component, which in turn is connected to a dbExpress "TSQLTable" component connected a a "TSQLConnection" component. The connection is configured to point to a demo "mastsql" InterBase database and the table component is pointing to "EMPLOYEE" table. By reopening client dataset and reconnecting to a database using checkboxes you can refresh data, and you can update data using a button that calls "TClientDataSet.ApplyUpdates" method that sends data to the underlying data store.
Scenario 3: Cloud storage
In this scenario we add to a FireMonkey application a data module with cloud data storage access logic. In Delphi XE2 the new CloudAPI has been introduced that abstracts away the underlying implementation of cloud storage. Here I’m using my Amazon Web Services S3 account to store a string value read from the user interface. Instead of storing the actual contents of the TClientDataSet component in the cloud storage, I’m actually using for testing the contents of the "Edit1" component. In order to use this example you need to make sure that valid credentials are declared in the "TCloudCustomConfig" class. You would also need to manually create a bucket and a file in the S3. The bucket and file names should also be entered into the config information.
Scenario 4: SOAP web services
In this scenario there are two projects. There is a Delphi XE2 SOAP Web Server project that implements two methods that "get" and "set" a string value. This value is persisted in a local file on the server. The client is our FireMonkey client application from the previous scenarios. In order to access SOAP web services, we need to use "WSDL Importer" wizard and generate client access code and use it in the user interface to persist an arbitrary string.
Scenario 5: DataSnap client
This scenario is similar to the previous one. This time the server is a standalone Delphi XE2 DataSnap server that provides two server methods for getting and setting a string value. The server functionality implementation is the same as in the previous example. In order to access DataSnap server functionality from our FireMonkey client application, we need to add client code to it using "DataSnap Client Module" wizard.