IQbservable OrderBy
-
Thursday, April 05, 2012 6:25 PM
Hi,
Would it make sense to define OrderBy, OrderByDescending, ThenBy and ThenByDescending operators for IQbservable<T>?
The reasoning is similar to why preconditions have been removed for various extension method parameters, such as the Take operator's count parameter: the query provider is entirely responsible for interpreting the query.
Furthermore, it makes sense for performance reasons; e.g., a hypothetical Reactive LINQ to SQL query should do the ordering entirely on the server, and if it determines that the ordering is by a clustered primary key, then the results of the query could still be pushed reactively without having to buffer because the rows are naturally ordered.
We already have OrderBy operators in Rxx for IObservable<T>, so I'd be happy to add them for IQbservable<T> if the Rx team feels that they could be useful but aren't interested yet in adding them to Rx.
Any other opinions on the matter?
- Dave
- Edited by Dave Sexton Thursday, April 05, 2012 6:27 PM Small clarification
All Replies
-
Friday, April 06, 2012 11:18 AMOwner
Any IObservable<T>-based operator can be complemented by its IQbservable<T>-based sibling, so if OrderBy is meaningfully defined in Rxx, having the homo-iconic variant alongside of it makes sense too.
Notice the AsObservable implementation on IQbservable<T> knows how to locate IObservable<T>-based operators given IQbservable<T>-based method info in expression trees. It simply looks for a method with the same name and an IObservable<T>-based (and delegate-based, rather than expression-based) signature alongside the IObservable<T>-based method in the same containing type. So, if you want to allow users to write an expression-tree based query, manipulate it, but yet execute it locally by using AsObservable, you have to make sure to put the methods next to each other.
using (Microsoft.Sql.Cloud.DataProgrammability.Rx) { Signature.Emit("Bart De Smet"); }
- Marked As Answer by Dave Sexton Friday, April 06, 2012 1:49 PM
-
Friday, April 06, 2012 1:59 PM
Hi Bart,
Thanks, I hadn't looked at the conversion behavior yet. I'll ensure that the conversion holds if I add these operators to Rxx.
http://rxx.codeplex.com/workitem/22461
- Dave
http://davesexton.com/blog

