In general, XPO is great. I like it because of two features:
- the ability to automatically update the database schema when connecting from the new version of the object model
- the default "mark-as-deleted" way of removing objects
There's however one scar on its beautiful face - incomplete Linq support.
No matter how fancy the Linq-To-Whatever implementation is - without Skip and Take it can never be fully adopted in enterprise systems. And XPO's implementation of Linq lacks the support of the Skip operation.
I am afraid that this is because XPO's implementation of paging is flawed by design: if you forget about Linq for a second, the only way to paginate is to use the XPPageSelector over your collection.
If you run the above code and in the same time you trace queries which are executed, you'll learn that:
- first, the whole collection of objects' identifiers is retrieved from the data source
- the page selector selects the identifier subset which refers to the page you select
- then, another query retrieves all the columns but only from the selected page of items
And if you realize that there are in fact two queries required to retrieve selected page of data, then you imagine how ineffective (difficult?) this could be when implementing Linq's Skip this way!
It's then no surprise that the only answer to the "when the Skip operator will be supported?" is "sorry, Skip is not supported":
Edit: if you find this post in early 2010 or later please consider it outdated. Both skip and take are now correcly handled by XPO's Linq provider. I've blogged about it.