{"action":"created","issue":{"url":"https://api.github.com/repos/OData/WebApi/issues/1387","repository_url":"https://api.github.com/repos/OData/WebApi","labels_url":"https://api.github.com/repos/OData/WebApi/issues/1387/labels{/name}","comments_url":"https://api.github.com/repos/OData/WebApi/issues/1387/comments","events_url":"https://api.github.com/repos/OData/WebApi/issues/1387/events","html_url":"https://github.com/OData/WebApi/issues/1387","id":314285240,"number":1387,"title":"[feature/netcore] $select executes on client side","user":{"login":"vsopko","id":15255277,"avatar_url":"https://avatars2.githubusercontent.com/u/15255277?v=4","gravatar_id":"","url":"https://api.github.com/users/vsopko","html_url":"https://github.com/vsopko","followers_url":"https://api.github.com/users/vsopko/followers","following_url":"https://api.github.com/users/vsopko/following{/other_user}","gists_url":"https://api.github.com/users/vsopko/gists{/gist_id}","starred_url":"https://api.github.com/users/vsopko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsopko/subscriptions","organizations_url":"https://api.github.com/users/vsopko/orgs","repos_url":"https://api.github.com/users/vsopko/repos","events_url":"https://api.github.com/users/vsopko/events{/privacy}","received_events_url":"https://api.github.com/users/vsopko/received_events","type":"User","site_admin":false},"labels":[{"id":614080758,"url":"https://api.github.com/repos/OData/WebApi/labels/P3","name":"P3","color":"006b75","default":false},{"id":767111348,"url":"https://api.github.com/repos/OData/WebApi/labels/feature/netcore","name":"feature/netcore","color":"28bfb2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-14T00:42:56Z","updated_at":"2018-04-17T17:51:04Z","closed_at":null,"author_association":"NONE","body":"<!-- markdownlint-disable MD002 MD041 -->\r\n\r\nAfter upgrading from Microsoft.AspNetCore.OData Version=7.0.0-beta1 to Microsoft.AspNetCore.OData Version=7.0.0-beta2 $select gets all entity properties from database and produces correct result on client side. This also occurs in nightly builds.\r\n\r\n### Assemblies affected\r\n\r\nMicrosoft.AspNetCore.OData Version=7.0.0-beta2\r\nMicrosoft.AspNetCore.OData Version=7.0.0-Nightly*\r\n\r\n### Reproduce steps\r\n\r\nUrl: `http://localhost:61734/api/values/?$select=Age&$top=1`\r\n\r\nController:\r\n```\r\n[Route(\"api/[controller]\")]\r\npublic class ValuesController : Controller\r\n{\r\n    private readonly Context _ctx;\r\n\r\n    public ValuesController(Context ctx)\r\n    {\r\n        _ctx = ctx;\r\n    }\r\n\r\n    [HttpGet]\r\n    public async Task<IActionResult> Get(ODataQueryOptions<User> queryOptions)\r\n    {\r\n        var users = _ctx.Users.Select(x => x);\r\n        return Ok(queryOptions.ApplyTo(users));\r\n    }\r\n}\r\n```\r\nContext model:\r\n```\r\npublic class User\r\n{\r\n    [Key]\r\n    public int Id { get; set; }\r\n    [Required]\r\n    public string UserName { get; set; }\r\n    public string FirstName { get; set; }\r\n    public string LastName { get; set; }\r\n    public int Age { get; set; }\r\n    public virtual ICollection<UserRole> UserRoles { get; set; }\r\n}\r\n```\r\n\r\n### Expected result\r\nReturn value:\r\n[{\"Age\": 50}]\r\n\r\nSql profiler:\r\nexec sp_executesql N'SELECT TOP(@__TypedProperty_0)\r\n[x].[Age] AS [Value]\r\nFROM [User] AS [x] N'@__TypedProperty_0 int',@__TypedProperty_0=1\r\n### Actual result\r\nReturn value:\r\n[{\"Age\": 50}]\r\n\r\nSql profiler:\r\nexec sp_executesql N'SELECT TOP(@__TypedProperty_0)\r\n**[x].[Id],**\r\n[x].[Age],\r\n**[x].[FirstName],\r\n[x].[LastName],\r\n[x].[UserName]**\r\nFROM [User] AS [x] N'@__TypedProperty_0 int',@__TypedProperty_0=1"},"comment":{"url":"https://api.github.com/repos/OData/WebApi/issues/comments/382083190","html_url":"https://github.com/OData/WebApi/issues/1387#issuecomment-382083190","issue_url":"https://api.github.com/repos/OData/WebApi/issues/1387","id":382083190,"user":{"login":"vsopko","id":15255277,"avatar_url":"https://avatars2.githubusercontent.com/u/15255277?v=4","gravatar_id":"","url":"https://api.github.com/users/vsopko","html_url":"https://github.com/vsopko","followers_url":"https://api.github.com/users/vsopko/followers","following_url":"https://api.github.com/users/vsopko/following{/other_user}","gists_url":"https://api.github.com/users/vsopko/gists{/gist_id}","starred_url":"https://api.github.com/users/vsopko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsopko/subscriptions","organizations_url":"https://api.github.com/users/vsopko/orgs","repos_url":"https://api.github.com/users/vsopko/repos","events_url":"https://api.github.com/users/vsopko/events{/privacy}","received_events_url":"https://api.github.com/users/vsopko/received_events","type":"User","site_admin":false},"created_at":"2018-04-17T17:51:04Z","updated_at":"2018-04-17T17:51:04Z","author_association":"NONE","body":"@robward-ms It's just a mark of projection experiments. Without it (var users = _ctx.Users;) SQL Server Profiler show the same query, with all columns. Anyway, i think evaluation of IQueriable occurs in Ok result, after ApplyTo method."}}
{"actor":{"display_login":"vsopko"}}