How to return Enumerable<T> from IQueryExecutor?


QueryProviderBase.Execute<T> has a cast near the end to (TResult). This is set to my own IQueryable type. How am I supposed to return a generic Enumerable<T> from the IQueryExecutor that actually provides the results?
Closed Mar 28, 2011 at 5:08 PM by FabianSchmied
This is not a work item, it's a question.


FabianSchmied wrote Mar 28, 2011 at 5:07 PM

Please ask your questions about using re-linq at "http://groups.google.com/group/re-motion-users". Do not create an issue tracker item for them.

IQueryExecutor defines three methods: ExecuteScalar<T>, ExecuteSingle<T>, and ExecuteCollection<T>. For queries that should return a sequence of values, ExecuteCollection<T> is called. The method receives a QueryModel that your QueryExecutor can analyze and translate into a query for your target system. The generic argument T defines what type of item the query should return.

So, you translate the QueryModel to a query for your target system and execute it. The target system returns a sequence of items of type T, and you then return those items as an IEnumeable<T>.

wrote Mar 28, 2011 at 5:08 PM

wrote Feb 14, 2013 at 6:23 PM

wrote May 16, 2013 at 8:32 AM