In this weekend we (I and Stef Heyenrath who joined the project some time ago) released Camlex for Client object model v.1.1. In this release support of RowLimit was added. In Client OM this tag is similar SPQuery.RowLimit property of basic Sharepoint object model, i.e. it allows to limit number of rows returned from the query. In CamlQuery class which is used in the client version, there is no separate property for row limit. Instead RowLimit tag is added with query to the ViewXml property. So it was quite natural to extend IQuery interface and add new method Take(int rowLimit) in it. So it will act as standard Take() method in Linq. Here is example:
1: var camlQuery = Camlex.Query()
2: .Where(x => (string)x["Title"] == "test")
will produce the following CAML:
5: <FieldRef Name=\"Title\" />
6: <Value Type=\"Text\">test</Value>
The idea of adding Take() method came from Stef, so all credits go to him. I helped with technical implementation only. New version is already on codeplex and in Nuget gallery.
Post a Comment