Difference between ODataQueryable() and SelectQuery() ?

Mar 25, 2014 at 10:32 PM
Edited Mar 25, 2014 at 10:32 PM
Hi Long,

I have spent most of the afternoon transitioning to the latest framework source code.

Where in the past I was doing something like:
_repository.Query().Get().Where(...)
... I now see that I can .Where() from .ODataQueryable() and .SelectQuery().

What is the difference between these two and when should they be used?
Coordinator
Mar 26, 2014 at 5:15 PM
Edited Mar 26, 2014 at 7:54 PM
ODataQueryable will be changed to Queryable, this is meant to only be used within the Repostiory layer and not in the presentation layer. This is so that you don't leak features that are specific to an ORM into your presentation layer, the only use case for ODataQueryable to be in application layer is when using Web Api OData.

SelectQuery will return an IEnumerable<TEntity> which is fine to use in your presentation layer, again, you want to try to the best of your ability to only return TEntity or IEnumerable<TEnttiy> to your presentation layer and contain or restrict IQueryable to only your repository layer.
Mar 26, 2014 at 8:34 PM
Great, thank you.
Coordinator
Mar 26, 2014 at 9:55 PM
Your welcome, BTW, here's an example of using Queryable directly when using with OData.

https://genericunitofworkandrepositories.codeplex.com/SourceControl/latest#main/Sample/Northwind.Web/Api/CustomerController.cs
Marked as answer by lelong37 on 3/31/2014 at 10:23 PM