public class Person { public string Name { get; set; } public Address[] PersonAddress { get; set; } }
public class Address
{
public string StreetName { get; set; }
public string City { get; set; }
}I have Person table and Column PersonAddress relates to Address table (1:N). This is how i am retrieving the data
BackendlessAPI.Persistence.BackendlessDataQuery query = new BackendlessAPI.Persistence.BackendlessDataQuery();
QueryOptions queryOptions = new QueryOptions();
queryOptions.Related = new List<String>();
queryOptions.Related.Add(“PersonAddress”);
queryOptions.Related.Add(“PersonAddress.Address”);
//BackendlessCollection<Person> person = Backendless.Persistence.Of<Person>().Find(query); //Tried this
BackendlessCollection<Person> person = Backendless.Data.Of<Person>().Find(query); // Tried this
throwing Object not set for instance of object error
replaced above queryOptions with relationsDepth
queryOptions.RelationsDepth = 2;
Worked fine
Question: Why is my first method did not work?