bugthesystem / FireSharp

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

OnAsync Call back #30

Open OmerObaid opened 8 years ago

OmerObaid commented 8 years ago

Hi,

var response = await client.client.OnAsync ("Todo/", (sender, args) => { Debug.WriteLine ("Hello"); Debug.WriteLine (args); });

Im trying to implement FireBase in my application(XF). I am facing an issue, When i Push "Todo" object in FireBase it comes to "OnAsync" call back and in "args" i m not receiving full Todo object. For example if Todo consits three attributes and i push Todo then OnAsync will be called three time, one attribute each time. So my question is, is there anyway to get snapshot object or something Pardon my english

Thanks.

sonicblis commented 8 years ago

With the async stream, you might get all sorts of different data structures back from firebase. You might get the whole set of items if you're listening to a collection when the listener starts, get just one of the items when a new one is added, or just one property value if only one is edited. It would be really tricky to figure out a way to deserialize that in a trustworthy way into an object .NET could use. What is implemented here is a way to take anything that firebase provides and provide it in a way that .NET can handle. As such, you have to put the object back together yourself, but at least you have a path and a value for each property instead of a string of JSON. =\

RameezStark commented 6 years ago

@sonicblis Can u elaborate. Did't quite understand..