EntitySetController currently returns an IQueryable<T> for its Get() function. When supplying the $select query, it'll throw an ArgumentException stating that it is unable to convert the SelectExpandWrapper to IQueryable.
I suppose the function should be changed to return an IEnumerable instead and set the QueryableAttribute on it.
I also think the functions that return T should be adapted to utilize SingleResult<T>?
Comments: Ok I just used Fiddler2 in addition to the REST client I already used. In both I made the following request to the function that has the property PageSize set ( [Queryable(PageSize=5)] ): ``` POST http://localhost:50505/api/Blacklist/PropertySet?$select=Name Accept: application/json X-API-Version: 1 Pragma: no-cache Cache-Control: no-cache Host: localhost:50505 Content-Length: 0 ``` (POST due to it being an OData Action. If OData Functions are available already, please tell me as I have not encountered any functionality for those yet) Both requests return: ``` { "odata.error":{ "code":"","message":{ "lang":"en-US","value":"An error has occurred." },"innererror":{ "message":"Object of type 'System.Data.Entity.Infrastructure.DbQuery`1[System.Web.Http.OData.Query.Expressions.SelectExpandWrapper`1[Entities.Blacklist]]' cannot be converted to type 'System.Linq.IQueryable`1[Entities.Blacklist]'.","type":"System.ArgumentException","stacktrace":" at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__a.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__21`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()" } } } ``` When calling the functions without properties set on the QueryableAttribute (just plain [Queryable]) everything is fine: ``` GET http://localhost:50505/api/Blacklist/?$select=Name Accept: application/json X-API-Version: 1 Pragma: no-cache Cache-Control: no-cache Host: localhost:50505 Content-Length: 0 ``` ``` { "odata.metadata": "http://localhost:50505/api/$metadata#Blacklist", "value": [ { "Name": "TestName1" }, { "Name": "TestName2" }, //etc ] } ```
I suppose the function should be changed to return an IEnumerable instead and set the QueryableAttribute on it.
I also think the functions that return T should be adapted to utilize SingleResult<T>?
Comments: Ok I just used Fiddler2 in addition to the REST client I already used. In both I made the following request to the function that has the property PageSize set ( [Queryable(PageSize=5)] ): ``` POST http://localhost:50505/api/Blacklist/PropertySet?$select=Name Accept: application/json X-API-Version: 1 Pragma: no-cache Cache-Control: no-cache Host: localhost:50505 Content-Length: 0 ``` (POST due to it being an OData Action. If OData Functions are available already, please tell me as I have not encountered any functionality for those yet) Both requests return: ``` { "odata.error":{ "code":"","message":{ "lang":"en-US","value":"An error has occurred." },"innererror":{ "message":"Object of type 'System.Data.Entity.Infrastructure.DbQuery`1[System.Web.Http.OData.Query.Expressions.SelectExpandWrapper`1[Entities.Blacklist]]' cannot be converted to type 'System.Linq.IQueryable`1[Entities.Blacklist]'.","type":"System.ArgumentException","stacktrace":" at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__a.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__21`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()" } } } ``` When calling the functions without properties set on the QueryableAttribute (just plain [Queryable]) everything is fine: ``` GET http://localhost:50505/api/Blacklist/?$select=Name Accept: application/json X-API-Version: 1 Pragma: no-cache Cache-Control: no-cache Host: localhost:50505 Content-Length: 0 ``` ``` { "odata.metadata": "http://localhost:50505/api/$metadata#Blacklist", "value": [ { "Name": "TestName1" }, { "Name": "TestName2" }, //etc ] } ```