f-miyu / Plugin.CloudFirestore

MIT License
121 stars 44 forks source link

How to treat my data ? #97

Open QuentR73 opened 2 years ago

QuentR73 commented 2 years ago

I get data from my database. This is a document with several data, including a Array with GeoPoint fields. var documents = await CrossCloudFirestore.Current .Instance .Collection("Activity") .GetAsync();

My object is defined like this in my Model class: public class Activity { public object elapsedTime { get; set; } public object positions { get; set; } ...... }

It works. I can have the data on my Activity class. However, I would like to know how I can access this data because foreach loops do not work for object types. Do you have any ideas ? Thx :=)

angelru commented 2 years ago

I don't quite understand what you mean, if you want to map your query to your MyActivity object:

var documents = await CrossCloudFirestore.Current.Instance.Collection("Activity").GetAsync();
var activities= documents.ToObjects<Activity>();