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).
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")]
Flex will receive an Arraycollection of PhoneVO objects.
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;
}
[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")]
Flex will receive a PersonVO object with a "phoneNumbers" property having an Arraycollection of PhoneVO objects.
[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;
}