Object retrieval depth

 

What is depth?

 

Depth allows retrieving only the required part of the object, e.g. object references object that references another object. This is particularly useful when there is no need to retrieve an entire object, with all arrays and objects are referenced.

 

Examples

 

Get only BasicUser, so called «shallow read»

 

var res = db.ExecuteQuery("SELECT BasicUser", 0)

 

In res you have objects BasicUser, where the fields are filled as follows:

 

    BasicUser

    {

        public Location HomeLocation = null;

 

        public Location CurrentLocation = null;

 

        public string Name = "John";

 

        public DateTime BirthDate = "10/12/2001";

 

        public string Interests = "reading, running";

 

        public BasicUser[] Friends = null;

 

        public WorkPlace UserWorkPlace = null;

 

        public School UserSchool = null;

 

        public string[] Emails = null;

    }

 

If you like to retrieve the objects of this object, you should use depth 1

 

var res = db.ExecuteQuery("SELECT BasicUser", 1)

 

In this case, BasicUser looks like this:

 

    BasicUser

    {

        public Location HomeLocation = Location { Country = "UK", City = "London", Street = "Baker St", PostCode = 1870};

 

        public Location CurrentLocation = Location { Country = "FR", City = "Paris", Street = "Phillip Due Rule", PostCode = 75008};;

 

        public string Name = "John";

 

        public DateTime BirthDate = "10/12/2001";

 

        public string Interests = "reading, running";

 

        public BasicUser[] Friends = new BasicUser{ null, null ..};

 

        public WorkPlace UserWorkPlace = WorkPlace { Location = null, Company = "Tait Electronics", Position = "Software Engineer"};

 

        public School UserSchool = School { Location = null, Name = "Thornleigh School"};

 

        public string[] Emails = {null, null};

    }

 

If you want to retrieve everything, you should use depth -1 or use one of the methods without using depth in parameters.