{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/7465","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/7465/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/7465/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/7465/events","html_url":"https://github.com/aspnet/Mvc/issues/7465","id":304000159,"number":7465,"title":"ActionDescription.BoundProperties not working as expected for FromQuery","user":{"login":"Mardoxx","id":239665,"avatar_url":"https://avatars3.githubusercontent.com/u/239665?v=4","gravatar_id":"","url":"https://api.github.com/users/Mardoxx","html_url":"https://github.com/Mardoxx","followers_url":"https://api.github.com/users/Mardoxx/followers","following_url":"https://api.github.com/users/Mardoxx/following{/other_user}","gists_url":"https://api.github.com/users/Mardoxx/gists{/gist_id}","starred_url":"https://api.github.com/users/Mardoxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mardoxx/subscriptions","organizations_url":"https://api.github.com/users/Mardoxx/orgs","repos_url":"https://api.github.com/users/Mardoxx/repos","events_url":"https://api.github.com/users/Mardoxx/events{/privacy}","received_events_url":"https://api.github.com/users/Mardoxx/received_events","type":"User","site_admin":false},"labels":[{"id":70264664,"url":"https://api.github.com/repos/aspnet/Mvc/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-03-09T22:25:23Z","updated_at":"2018-03-13T17:31:23Z","closed_at":"2018-03-13T17:01:42Z","author_association":"CONTRIBUTOR","body":"```cs\r\n[Route(\"api/values\")]\r\npublic class ValuesController : Controller\r\n{\r\n    [HttpGet]\r\n    [CustomMethodSelector]\r\n    public IActionResult Get([FromQuery] int? number)\r\n    {\r\n        return Ok(number);\r\n    }\r\n}\r\n\r\npublic class CustomMethodSelectorAttribute : ActionMethodSelectorAttribute\r\n{\r\n    public CustomMethodSelectorAttribute()\r\n    {\r\n    }\r\n\r\n    public override bool IsValidForRequest(RouteContext routeContext, ActionDescriptor action)\r\n    {\r\n        var boundProps = action.BoundProperties\r\n            .Select(x => x.Name)\r\n            .ToList();\r\n\r\n        Console.WriteLine($\"[{String.Join(\",\", boundProps)}]\");\r\n\r\n        return true;\r\n    }\r\n}\r\n```\r\n\r\n`GET api/values`\r\n\\> []\r\n\r\n`GET api/values?number`\r\n\\> []\r\n\r\n`GET api/values?number=`\r\n\\> []\r\n\r\n`GET api/values?number=1`\r\n\\> []\r\n\r\nI'd expect it to be [], [number], [number], [number] respectively, or at least [number] on the last one judging how ASP.Net handles empty query values.\r\n\r\nDoes this only work for FromBody/FromForm?"},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/372751025","html_url":"https://github.com/aspnet/Mvc/issues/7465#issuecomment-372751025","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/7465","id":372751025,"user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars2.githubusercontent.com/u/174281?v=4","gravatar_id":"","url":"https://api.github.com/users/pranavkm","html_url":"https://github.com/pranavkm","followers_url":"https://api.github.com/users/pranavkm/followers","following_url":"https://api.github.com/users/pranavkm/following{/other_user}","gists_url":"https://api.github.com/users/pranavkm/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavkm/subscriptions","organizations_url":"https://api.github.com/users/pranavkm/orgs","repos_url":"https://api.github.com/users/pranavkm/repos","events_url":"https://api.github.com/users/pranavkm/events{/privacy}","received_events_url":"https://api.github.com/users/pranavkm/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T17:31:23Z","updated_at":"2018-03-13T17:31:23Z","author_association":"MEMBER","body":"Seems like we're talking past each other, let's go over this again:\r\n\r\n* A controller or a Razor page handler may have bound properties indicated by `ActionDescription.BoundParameters`. An action also has parameters listed by `ActionDescription.Parameters`. Parameters are always model bound.\r\n* Both BoundProperties and parameters may be annotated with specific attributes that disallows binding. `ModelMetadata.IsBindingAllowed` indicates if binding is allowed on parameters or bound properties. Note: for most parts, this only works correctly in 2.1.0.  See https://github.com/aspnet/Mvc/issues/6790 and it's PR https://github.com/aspnet/Mvc/pull/6842 for further details on what this entails.\r\n\r\nDoes this answer your question?"}}
{"actor":{"display_login":"pranavkm"}}