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>
<Query>
<Where>
<BeginsWith>
<FieldRef Name="ContentTypeId" />
<Value Type="ContentTypeId">0x010200</Value>
</BeginsWith>
</Where>
</Query>
<ViewFields>
</ViewFields>
<RowLimit Paged="TRUE">2147483647</RowLimit>
</View>
No comments:
Post a Comment