Fluorine .NET Flash Remoting Gateway

RPC data access using Datasets and Datatables

By design a DataSet or DataTable instance is sent as an untyped object to Flex (the mx.remoting.RecordSet class does not exist in Flex2).

Attributes to control how a DataSet or DataTable is sent

These attributes are defined in the com.TheSilentGroup.Fluorine namespace.

[DataTableType(string remoteClass)]
[DataTableType(string tableName, string remoteClass)]
[DataTableType(string tableName, string propertyName, string remoteClass)]

The DataTableTypeAttribute specifies the type of data in a DataTable. Rows will be serialized as a collection of strongly typed ASObjects (table columns are stored as property values).

The second and third overloads are used in combination with the DataSetTypeAttribute attribute.

Sample:

    [DataTableType("FlexRemoteObjectSample.PhoneVO")]
    public DataTable GetDataTable()
    {
        DataSet dataSet = new DataSet("mydataset");
        DataTable dataTable = dataSet.Tables.Add("phones");
        dataTable.Columns.Add( "number", typeof(string) );
        dataTable.Rows.Add( new object[] {"123456"} );
        dataTable.Rows.Add( new object[] {"456789"} );
        return dataTable;
    }
Flex will receive an Arraycollection of PhoneVO objects.

[DataSetTypeAttribute(string remoteClass)]

Specifies that the DataSet will be serialized as a strongly typed ASObject. Use this attribute in combination with the DataTableTypeAttribute (DataTableTypeAttribute for each table).

Sample:

    [DataSetType("FlexRemoteObjectSample.PersonVO")]
    [DataTableType("phones", "phoneNumbers", "FlexRemoteObjectSample.PhoneVO")]
    public DataSet GetDataSet()
    {
        DataSet dataSet = new DataSet("mydataset");
        DataTable dataTable = dataSet.Tables.Add("phones");
        dataTable.Columns.Add( "number", typeof(string) );
        dataTable.Rows.Add( new object[] {"123456"} );
        dataTable.Rows.Add( new object[] {"456789"} );
        return dataSet;
    }
Flex will receive a PersonVO object with a "phoneNumbers" property having an Arraycollection of PhoneVO objects.