This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Is there any support for using the NextToken in SimpleDB paging? Sample Code from Amazon showing paging:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2382 What I would like to do is something like: ------------------------------------------------------------------------------------------ int count = 10; var page1 = Data.Objects.OrderByDescending(x=> x.CreatedOn).Take(count).ToList(); foreach(var obj in page1 ) { // Display results } // Lightspeed could inject a property called 'NextToken' and fill it on the last entity object string myNextToken = page1[page1.count - 1].NextToken; //OR string myNextToken = page1.FirstOrDefault(x => x.NextToken != "").NextToken; //Then, by sending in a query parameter for NextToken, lightspeed could //send that into SimpleDB as special instructions: var page2 = Data.Objects.Where(x => x.NextToken == myNextToken ).OrderByDescending(x => x.CreatedOn).Take(count).ToList(); ------------------------------------------------------------------------------------------ Any way this could be possible? Thanks, -Joe Freeman
|
|
|
This is not possible at the moment because of the stateless nature of LightSpeed queries. That is, a query specifies a range (e.g. Offset 30 / Limit 10), and this is independent of any other query. In order to use the NextToken to accomplish paging, we would need to retain the NextToken between queries (and, to support backward paging, to track NextTokens throughout the history of the query). Your suggestion of allowing the application to store the NextToken and to feed it back into queries (effectively allowing a NextToken to be used as a Page.Offset) is a possible way out of this, but we will need to think about how we can surface this in a way that doesn't complicate the API for non-SimpleDB developers. |
|
|
Any temporary workaround you can provide us for allowing the applicagtion to store the token would be much appreciated. Thanks, -Joe |
|
|
Hello Joe, I've implemented experimental support for this and it will be included in nightly builds dated 28 Apr 2009 and above, available after about 1430 GMT. Support consists of two parts. Both of these are marked EditorBrowsable(Never) so they may not show up in Intellisense but they are there! These are: * Page.OffsetCookie property. After performing a SimpleDB query with a Page object, the Page's OffsetCookie property will contain the NextToken if there is one. * Page.Next static method. To use the returned NextToken in another query, call Page.Next, passing the OffsetCookie of the previous query and the page size for the new query. Pass this Page to the new query. For example: using (IUnitOfWork uow = Context.CreateUnitOfWork()) Please let us know if you run into any problems. |
|