Which is better, CAML query or LINQ query in SharePoint 2010 ?

Collaborative Application Markup Language (CAML) vs Language-Integrated Query (LINQ)
CAML is always better than LINQ because if you write LINQ query then finally it converts in CAML internally so it down the performance. Of course there is other advantages of LINQ like: Sorting/filtering/can return objects / Most imp part, it is object oriented etc.

LINQ Example:

site.Load(Groupcoll, groups => groups.Include(group => group.Users));

CAML Query Example:

<View>
  <Query>
    <Where>
      <BeginsWith>
        <FieldRef Name="ContentTypeId" />
        <Value Type="ContentTypeId">0x010200</Value>
      </BeginsWith>
    </Where>
  </Query>
  <ViewFields>
  </ViewFields>
  <RowLimit Paged="TRUE">2147483647</RowLimit>
</View>

See this link for more details

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

Add content type to SharePoint List/Library using REST API

A type named 'SP.Data. could not be resolved by the model error