Fluorine .NET Flash Remoting Gateway

Using Pageable Recordsets

Pageable recordset is a feature of the Actionscript Recordset Class which allows you to divide the result of a query into different pages and decide how to fetch the returned rows.

1. To activate the pageable recordset feature, the service method must be marked with a com.TheSilentGroup.Fluorine.PageSizeAttribute attribute.

Available constructors:

PageSizeAttribute(int pageSize)
PageSizeAttribute(int pageSize, int offset, int limit)

where

pagesize - number of records requested each time
offset - the offset of the first row to return
limit - the maximum number of rows to return

2. The last 2 method parameters must be the offset and the limit. Only simple types are supported for parameters.

3. A [methodName]Count method must be available to get the total record count. The return type is "int".

Sample service class:

public class DataService
{

    [PageSize(10)]
    public object GetRecords(string filter, int offset, int limit)
    {
        ...
        string query = string.Format("SELECT * FROM table LIMIT {0}, {1}", offset, limit);
        MySqlDataAdapter adapter = new MySqlDataAdapter(query, connection);
        DataTable dataTable = new DataTable();
        adapter.Fill(dataTable);
        return dataTable;
    }

    public int GetRecordsCount()
    {
        ...
        MySqlCommand command = connection.CreateCommand();
        command.CommandText = "SELECT COUNT(*) FROM table";
        object result = command.ExecuteScalar();
        return System.Convert.ToInt32(result);
    }
}