I’m glad to announce that today we’ve released Camlex version for client object model (managed clients). Special credits go to Stef Heyenrath who joined Camlex project and did the main work for releasing of client object model. He will maintain client object model from now. Also I would like to thanks user with nickname Scriv, who created this feature request on Camlex site on Codeplex and showed example of how basic Camlex can be transformed to the client object model.
You can download client object model from codeplex or using nuget:
1: Install-Package Camlex.Client.dll
Client version is based on basic Camlex.Net 3.2. It contains all features which basic Camlex has (except those which are mentioned below) and is also fully reversible. The following changes were done:
- References are changed Microsoft.SharePoint.dll to Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll
- Use ListItem instead of SPListItem
- Remove guid and int indexers support as they don't exist in ListItem
- Modify .ToCaml() to only output xml with a surrounding View and Query elements
- Remove IQueryEx interface which contained all ViewFields methods. In SPQuery there is separate property ViewFields, so you can’t specify both Query and ViewFields in the same fluent methods chain. But in client version everything is specified in single property CamlQuery.ViewXml, so this separate interface is not needed there
- Method ToCamlQuery() was added to IQuery interface which returns ready for use CamlQuery instance.
Then all unit tests were fixed. Here is example of the usage:
1: var camlQuery = Camlex.Query()
2: .Where(x => (string)x["Title"] == "test")
3: .ToCamlQuery();
It will return instance of CamlQuery class which ViewXml property will be set to the following CAML query:
1: <View>
2: <Query>
3: <Where>
4: <Eq>
5: <FieldRef Name=\"Title\" />
6: <Value Type=\"Text\">test</Value>
7: </Eq>
8: </Where>
9: </Query>
10: </View>
We created separate branch for client object model. Starting from now all new features in basic Camlex will be reviewed to check whether they can be added to the client version and vise versa. I.e. they will be maintained in sync with each other.
No comments:
Post a Comment