{"action":"opened","issue":{"url":"https://api.github.com/repos/OData/WebApi/issues/1257","repository_url":"https://api.github.com/repos/OData/WebApi","labels_url":"https://api.github.com/repos/OData/WebApi/issues/1257/labels{/name}","comments_url":"https://api.github.com/repos/OData/WebApi/issues/1257/comments","events_url":"https://api.github.com/repos/OData/WebApi/issues/1257/events","html_url":"https://github.com/OData/WebApi/issues/1257","id":301629926,"number":1257,"title":"[feature/netcore] Ability to modify query after applying queryOptions","user":{"login":"techniq","id":177476,"avatar_url":"https://avatars2.githubusercontent.com/u/177476?v=4","gravatar_id":"","url":"https://api.github.com/users/techniq","html_url":"https://github.com/techniq","followers_url":"https://api.github.com/users/techniq/followers","following_url":"https://api.github.com/users/techniq/following{/other_user}","gists_url":"https://api.github.com/users/techniq/gists{/gist_id}","starred_url":"https://api.github.com/users/techniq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techniq/subscriptions","organizations_url":"https://api.github.com/users/techniq/orgs","repos_url":"https://api.github.com/users/techniq/repos","events_url":"https://api.github.com/users/techniq/events{/privacy}","received_events_url":"https://api.github.com/users/techniq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-02T02:18:13Z","updated_at":"2018-03-02T02:18:13Z","closed_at":null,"author_association":"NONE","body":"### Assemblies affected\r\n\r\n- `7.0.0-Nightly201803011314`\r\n\r\n### Reproduce steps\r\n\r\nIn OData 6.x, it used to be possible to cast the result of `queryOptions.ApplyTo(...)` as an `IQueryable<T>` where `T` is the type of the `DbContext.Set<T>()` and make further changes.\r\n\r\nFor example, I would use this to add additional fields, apply additional filtering, etc before returning a result.  A use case would be to provide an `Export` capability, such as this trivial example.\r\n\r\n```c#\r\n[HttpGet]\r\npublic IActionResult Export(ODataQueryOptions<Employee> queryOptions)\r\n{\r\n    var query = queryOptions.ApplyTo(DbContext.Set<Employee>()) as IQueryable<Employee>;\r\n    var exportQuery = query.Select(e => new EmployeeExport\r\n    {\r\n        Name = e.Name,\r\n        // ...\r\n    });\r\n    return Ok(exportQuery);\r\n}\r\n```\r\n\r\n### Expected result\r\n\r\nAbility to continue to modify query after calling `queryOptions.ApplyTo(...)`\r\n\r\n### Actual result\r\n\r\nIf the odata query contains anything except for `$filter` (for example, `$top`, `$select`, or `$expand`), the result is not castable to `IQueryable<T>` (returns null) \r\n\r\n"}}
{"actor":{"display_login":"techniq"}}