I'm having trouble figuring out how to query for a 3rd parties data. Here's how it's structured
/bucketa/bucketb/bucketc/someguidtypekey/anotherguidtypekey/(fields I want to map here)
I've tried this:
var stats = await firebase.Child("bucketa/bucketb/bucketc").OnceAsync<WrapperClass>();
Where WrapperClass is a Key/Object combo, then THAT object is another Key/Object combo, and then that object is the actual class.
public class WrapperClass
{
public string Key { get; set; }
public WrapperClass2 Stats { get; set; }
}
public class WrapperClass2
{
public string Key { get; set; }
public RealClass Stats { get; set; }
}
public class RealClass
{
public string Field1 { get; set; }
public string Field2 { get; set; }
public string Field3 { get; set; }
public string Field4 { get; set; }
}
I've also tried:
var stats = await firebase.Child("bucketa/bucketb/bucketc/*/*").OnceAsync<RealClass>();
But that just returned a string of the object type.
Can anyone help out here?
This is in C#, using FirebaseDatabase.net
Edit:
All right, now we are getting closer. Implementing @ElmarJensen fix (from one of his comments):
...OnceAsync<Dictionary<string, Dictionary<string, RealClass>>>();
I'm now getting the error:
Error converting value True to type 'RealClass'
In the error, it says it's trying to convert RealClass.property1 where property1 is of type bool.
Why is it trying to convert the property1 to my RealClass object type instead of the parent object? The structure makes sense to me. And in the exception, the "responseData" property has all of the records that I expected in the correct JSON format, so not sure what's going on here.
Edit 2: Here's the actual data format:
{
"0M6bRFLLokR6sIJAcKFN6y91NXB3": {
"-KYdDf62eQUMGb-ov737": {
"somethingBoolean":true,
"asdf":"Joe User",
"oasdfasdfsad": {
"firstName":"asdf",
"lastName":"asdfasdf",
"tasdfme":"Wasdfh",
"teasdfore":6,
"teaasdfme":"SDFO"
},
"fasdfewaef":0,
"startedAt":1.481381640492956E9,
"updatedAt":1.481381687802693E9,
"wfefeaefw":"182",
"asdf": {
"firstName":"asdf",
"lastName":"asdf",
"asdf":"asdfasdfasdf",
"teamScore":0,
"asefeawfawef":"DFDFSWEF"
},
"aefawefawefawefawef":0
}
}
}