bugthesystem / FireSharp

An asynchronous cross-platform .Net library for Firebase
The Unlicense
696 stars 147 forks source link

How to calculate the total records in the tables #59

Closed ntdatgoquovn closed 7 years ago

ntdatgoquovn commented 8 years ago

Dear author,

Please let me know. How to calculate the total records in the database. I want to use it to paging

Thank you very much.

arcosmin commented 7 years ago

Not by default, Firebase doesn't provide it. You would need to load all the data or save and maintain a counter on the database. The workaround for pagination would be

var start = 0;
var end = 10;

var response = await _client.GetAsync("path", QueryBuilder.New().OrderBy("field_name").StartAt(start.ToString()).EndAt(end.ToString()));
var result = response.ResultAs<List<TestClass>>();