Many people in the use of the client object model, do not know when or should not load, today see an idea to describe the problem, feel very reasonable, and share with you. That is, writing the client object model is like writing a SQL statement. You can use complex query statements at will, and when you want to see the results, execute the SQL statement. There is no question of code efficiency, which is another topic.
The meaning of the client object model is the same, you can use the object as well as the object's properties to build the object you want, but when you want to use the result object or want to see the results, it is time for you to load.
A typical example:
1. When you want to query the Web title, at the level of the web you have to load.
web = context.web;
Context.load (web, ' Title ');
Context.executquery ();
Web. The title can be obtained.
2. When you want to query the item, the web is not load, even the list does not load, you just need to build ListItemCollection object, and then load the ListItemCollection object
List = Context.web.get_lists (). Getbytitle (' ASD ')
Olistitems = Orglist.getitems (camlquery);
Context.load (Olistitems);
Just a little bit of my personal opinion.
About SharePoint's client object model when load and execut query a point of their own view