SharePoint 2010 LoadQuery Vs Load Methods

In SharePoint 2010 we can speak about a year continuously about the new features and APIs. They have included plenty of things and should be made developer life easy!!!
Here is a nice concept I want to tell to my readers about what is the difference between the load() and loadQuery() methods. The main definition both will use to load the data or objects you want from the SharePoint server. Then where is the difference?

To reduce the confusion, first, we will discuss these in the Managed Client OM [C#].
1. Difference in syntax:
Managed Client object model supports two types of syntax in data retrieval process. One is Query syntax [Linq] and another is Method Syntax.

In Query syntax we are using Linq to create queries. Remember, here we are doing Linq to Objects querying but not Linq to SharePoint Provider. It means all the stuff we are writing is client side coding, we can't make or write queries to Linq to SharePoint provider. So, everything should be Linq to Objects only. LoadQuery() syntax can only be used with the query syntax. I mean if you want to write Linq query and execute against client object model, then we should use LoadQuery(). In other words, LoadQuery method takes an object of type IQueryable as its parameter, and this allows us to write LINQ queries instead of CAML to filter the results. Take the below example.
var query = from list 
in clientContext.Web.Lists
where list.Hidden != false
select list;

var result = clientContext.LoadQuery(query);
clientContext.ExecuteQuery();
In the above example, I have used the Linq query to find all the lists which are not hidden. So, this is a straight Linq query and we should use the LoadQuery() method to execute it and get result.

Method syntax can be used with either Load() or LoadQuery(). We can use Lambda expressions to query the data. We can use the same above example with lambda expressions as below.
clientContext.Load(clientContext.Web, 
website => website.Lists.Include(
list => list.Title).Where(
list => list.Hidden != false));

clientContext.ExecuteQuery();
It also produces the same result as above. But the only difference is syntax.
In the above example, we have used the Include phrase. What's is this? It's main advantage is for the performance and efficiency.

How it is improving performance? Because we are returning only the properties we need, not all from the server belongs to requested object. So, Include phrase will tell the server to return only the properties defined in me. In our example, it only asks for Title, so server returns only Title property and loads into the response. This will increase the performance for sure.

How to use Include in LoadQuery() syntax?
IEnumerable hiddenLists = clientContext.LoadQuery(
listCollection.Include(list => list.Title).Where(list => !list.Hidden));

2. Difference in implementation:
Load method populates the client object directly with what it gets data from the server. But LoadQuery returns the data as a completely new collection. For better understanding, LoadQuery() returns the data in the format of IEnumerable<object>. It means all the collection is of type IEnumerable but not straight object collection. For example, in the above example, we have tried to retrieve all lists from the server which are not hidden. If we use Load() method, it returns the ListCollection type. If we use LoadQuery() it returns the IEnumberable type instead of ListCollection. Because of this, when you use Load() method the data will be garbage collected if and only if the ClientContext object goes out of scope. Whereas LoadQuery() object will be garbage collected if the enumerable object goes out of scope irrespective of the ClientContext object.

Using ECMAScript LoadQuery() Vs Load()
What we have discussed about them in the Managed Client Object Model are same here except the server side concepts like garbage collection etc... We will discuss now on how we can implement them in the ECMAScript.
load():
var web = clientContext.get_web();
var lists = web.get_lists();
clientContext.Load(lists, 'Title');
loadQuery():
var collList = clientContext.get_web().get_lists();
this.lists = clientContext.loadQuery(collList, 'Include(Title)');
For filtering data, we need to write the CAML Queries and pull information from server.

Hope this whole concept is completely about the difference between and loadquery and load. And I believe you better understand it. Please let me know the feedback and questions if you have any. Read More...

Porsche Lumma Design CLR 550 R

Meanwhile, under the front cover Lumma Design started with the already powerful 4.8-liter V8 engine that has a standard power of 400 hp In the case of CLR 500 R, however, an additional compressor, which is Scotch on the power more than 50% compared with that of serial Cayenne GTS. And we are accurate, should specify that a power of 612 hp under the front cover. They are transmitted through the asphalt to huge 23-tsolovi wheels obuti in ultra niskoprofilni tires. In general, looks like wheels are painted in black on the end ... This was the tires.

http://img.worldcarfans.com/2008/11/medium/lumma-design-clr-550-r-porsche-cayenne-facelift_5.jpg
To help the Cayenne hard to cope with additional power, Lumma also installed and sports brake system, which provides more power - a good idea in view of the fact that the rate of 612-they koncheta definitely not negligible, especially in a massive and heavy SUV. The car is otherwise reduced by the sport suspension is set so as to reduce the maximum lashkaneto in turn.

http://www.rpmgo.com/cars/d/37070-2/porsche_cayenne_tuning_lumma05.jpg
Inside the interior is a bit more color, as is available in dvutsvetna color. Furthermore, there is a new sport steering wheel and improved telematics system.



Read More...

aston martin db9 wallpaper


aston martin db9
aston martin db9

aston martin db9 wallpapers
aston martin db9 wallpapers

aston martin db9
aston martin db9

aston martin db9 wallpapers
aston martin db9 wallpapers

aston martin db9
aston martin db9

Read More...

aston martin db9 wallpaper


aston martin db9
aston martin db9

aston martin db9 wallpapers
aston martin db9 wallpapers

aston martin db9
aston martin db9

aston martin db9 wallpapers
aston martin db9 wallpapers

aston martin db9
aston martin db9

Read More...

Porsche Panamera 9ff

Porsche Panamera 9ff

The new sedan to the Porsche - Panamera - is not expected to appear on the market before the first half of next year. And although this model will clearly enjoys great popularity among specialists in tuning, as already has computer graphics will look how a modified version of 9ff. And this is not accidental company - still 9ff created that GT9, which may compete with the Bugatti Veyron, and the 911 Turbo Cabrio with power of 780 hp


http://www.0-60mag.com/online/wp-content/uploads/2009/08/2345035.jpg
German masters, who are specialists in a Porsche, has already confirmed that their next major project will be based on the Panamera. While orders for the car is already adopted, it 9ff insist that the project is in very early stage of development.

And while no official specifications for the package, it can learn some things from computer graphics. At least can understand quite ready to form Panamera. For the first time can be seen glass roof of the Porsche, and the rear window. The same is true for the rear lights and rear runout.



Read More...

Bugatti Veyron Price


Bugatti Veyron Price


Bugatti Veyron Price


Bugatti Veyron Price


Bugatti Veyron Price
Read More...

audi tt
audi tt

audi tt pictures
audi tt pictures

audi tt wallpapers
audi tt wallpapers

audi tt
audi tt

audi tt wallpapers
audi tt wallpapers

Read More...

audi tt
audi tt

audi tt pictures
audi tt pictures

audi tt wallpapers
audi tt wallpapers

audi tt
audi tt

audi tt wallpapers
audi tt wallpapers

Read More...

Nissan Skyline

Nissan Skyline

Nissan Skyline
Nissan Skyline Wallpapers
Nissan Skyline Wallpapers
Nissan Skyline
Nissan Skyline Images
Nissan Skyline Photos
Nissan Skyline Photos
Read More...

2010 Audi A1

2010 Audi A1
2010 Audi A1
2010 Audi A1 Wallpapers
2010 Audi A1 Wallpapers
2010 Audi A1
2010 Audi A1 Photos
2010 Audi A1 Interior
2010 Audi A1 Interior
Read More...

Lancer Evo X

Lancer Evo X
Lancer Evo X
Lancer Evo X
Lancer Evo X Wallpapers
Lancer Evo X Wallpapers
Lancer Evo X Photos
Lancer Evo X Photos
Lancer Evo X Images
Read More...

Fiat 500 Abarth

Fiat 500 Abarth

Fiat 500 Abarth
Fiat 500 Abarth
Fiat 500 Abarth Wallpapers
Fiat 500 Abarth Wallpapers
Fiat 500 Abarth Photos
Fiat 500 Abarth Images
Fiat 500 Abarth Images
Read More...

SharePoint 2010 HTML Markup changes in rendering

Wow. SharePoint 2010 has lot of new features. Everyone knows that. But, among all of them, the main thing I have really loved is the HTML markup generated for the SharePoint 2010. You know what? They have replaced the tables with Div and ul, li etc. So, this is a very good thinking and change from SharePoint team which likes by all and browsers. Everyone knows what are the problems with TABLES and in SharePoint 2007 you find many many tables. But not any more in SharePoint 2010.
Below is the simple snapshot which is taken from the view source of SharePoint 2010 Publishing site template.

What if you are trying to migrate from SharePoint 2007 to SharePoint 2010? 2007 version is built on TABLES and 2010 version is built on DIVS. Don't confuse here. All the SharePoint built-in controls like SharePoint navigation, Quick launch etc renders as TABLES in SharePoint 2007 and in SharePoint 2010 they render as Divs.  So, the format is changed. If you have done plenty of customization in 2007 web site and tried to migrate 2010 site, then I am not sure you will be succeeded in formatting after migration. So, by considering this issue into account Microsoft SharePoint team introduced a nice concept called "visual Upgrade". So, what this means? Once you are done with the migration, do you want to change the UI [visual upgrade] from v3 to v4 or not . V3 uses the version 3 rendering the TABLES formatting, whereas V4 uses the Version 4 renders in the format of DIVS. For better understanding the concept, I will show you above terms in terms of figures.

Visual Upgrade
Once we are done with SharePoint site migration[to SharePoint 2010], you will see the same layout and UI as previous site [SharePoint 2007]. The UI is not really migrated to the SharePoint 2010 UI [V4]. So, what to do to migrate UI too to SharePoint 2010 format?
Now, you can see a new item in the site actions menu named "Visual Upgrade" as shown below.
When you click on the Visual Upgrade option, then you go to a page where you can see three options to preview how it looks like in v4. See below image.
  1. Here, the option 1 means, display the same UI as the v3 UI. i.e. Your SharePoint 2007 UI.
  2. Option 2 is, Preview the site in V4 mode, but, don't save it permanently. So that you have chance to take a look at the site in V4 mode and if you think UI is not well formatted then revert the changes back to V3.
  3. Option 3 is, Permanently change the UI to V4 mode. If you select this, then you can't change the UI back to V3 mode and the option "Visual Upgrade" under site actions will go away.
 I think, you understood it well and will greatly use the advantage of this feature. Love to hear something from you. Read More...

Porsche Carrera GT 9FF

2008 9ff Carrera GTT 900
Porsche Carrera GT 9FF

Carrera GT can no longer be available in series production, but not stopped specialists 9ff to work on more sports package strahovitiya superavtomobil. The latest work of tuning specialists called GTt 900, which was shown only during the motor exhibition in Essen.

2008 9ff Carrera GTT 900
Adding turbo to double the already very powerful V10 engine of the Carrera GT specialists 9ff have managed to add additional 300 hp to the standard model. Other changes include new distribution shafts in sports collectors and special damper unique intake systems. The end result is 900 hp power

2008 9ff Carrera GTT 900
The technical side of the Porsche Carrera GT, however, is not only its strength. Regarding the exterior worth to mention bright red scheme contrast with carbon accents entirely kustomiziran bodikit with slightly open front wheels. Has yet to understand how lucky you have the opportunity to tuningovat so your car, but the fact is that once again by 9ff have done a great job. Thanks to the road site supercars.net have the opportunity to show more of that athlete.

2008 9ff Carrera GTT 900
Porsche Carrera GT 9FF

Otherwise 9ff used motor show from last weekend to show their (still in a period of development) superavtomobil GT9 R, which the company hopes to make the fastest production car series. With a capacity of 1120 hp and torque of 1050 nm and forced injection, the new model would have to develop a higher maximum speed of the current 411 km / h on SSC Ultimate Aero TT
.
2008 9ff Carrera GTT 900



Read More...

SharePoint 2010 ECMAScript - How to know logged in user information

This is post which is simple and not really needed. But when I started writing the code in ECMAScript I have faced problems in getting the logged in user information. So, my readers may feel good after see this post and really most the users are looking for this too.
By this time, we have really understood all about ECMAScript Client Object Model and debugging. So, it's easy for us to know it well.
Please find the code below to get the current user information.
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js");
var context = null;
var web = null;
var currentUser = null;
function getWebUserData() {
context = new SP.ClientContext.get_current();
web = context.get_web();
currentUser = web.get_currentUser();
currentUser.retrieve();
context.load(web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}
function onSuccessMethod(sender, args) {
var userObject = web.get_currentUser();
alert('User name:' + userObject.get_title() + '\n Login Name:' + userObject.get_loginName());
}
function onFailureMethod(sender, args) {
alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
So, the above code returns you the user object and displays user name and user login name. You can customize it as you want and please let me know the feedback or questions you have. Read More...

SharePoint 2010 ECMAScript - how to know all methods in SP object and debug

After spent good time to write nice posts on Client Object Model and ECMAScript how to use, I want to present you another nice tip on how we know all the methods and properties available for the SP object in the ECMA javascript . MSDN documentation is not finalized or completed yet to know what properties and methods  for SP objects have. And when you want to query something [like list or web] and you are not aware of what it has inside methods and properties, then the best way as far as I know is, using the Javascript debugging using Internet Explorer.

If you take the same example which from the post "How to get the web site properties", I have declared the web object and reading that when it fills. How I knew that for the web object there are methods named get_title() and get_id()? Follow the below steps to reveal that.
  1. After you are ready with the script added to the page, Follow the steps...
  2. Open the page in Internet Explorer and Select Developer Tools from Tools Menu as shown in below figure. Needs >= IE 7 version installed.
  3. Find the script tab from the developer tools.
  4. Select the file from the list of files where the custom javascript you have written.
  5. Now go to the location of javascript code, and place the break point to debug.
  6. Now, on the top, click on the button start debugging. This will start loading the breakpoints in the files. When the code reaches where the breakpoint is present debug starts and you can find them.
  7. Now, go to the ASPX page and refresh it. From the page execute the code. [If you have written code to execute on page load then fine we don't do anything, it will automatically reaches breakpoint and if you have written the code to execute when some event raises then do raise that event(just like button click or something else).]
  8. When you do that, then the debugger will find the breakpoint and starts debugging as shown below.
  9. Press F10 to repeat through the code one line at a time. Stop at the place where you want to debug and find the methods of an object or see the values and select that part and right click, select "Add Watch". For example, In my case I am trying to find the web properties and adding watch the web object as shown in the below figure.
  10. Now see all the existing methods available for the object. This is the best and efficient way to know the methods in an object and another advantage is you can directly see what value it will return by using a specific method by adding that to watch. But take care, you can see only the data which is actually coming from the server. You have selected Title and Id from the example we are using, If you use the method web.get_description() then it will give you error. So, make sure you have loaded the property before you access it.
This is what all about knowing the properties and debug the data and see the information. It has helped me so many times and in fact I rely on this to know the methods in any SP object. The will surely help to all SharePoint 2010 devs who are working on the ECMAScript client object model. Hope you like this post and it helps you for better programming. Read More...
Related Posts with Thumbnails
GiF Pictures, Images and Photos