{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/7799","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/7799/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/7799/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/7799/events","html_url":"https://github.com/aspnet/Mvc/issues/7799","id":324948317,"number":7799,"title":"ApiControllerAttribute's binding of complex parameter cannot be overridden.","user":{"login":"jamiewinder","id":4442179,"avatar_url":"https://avatars3.githubusercontent.com/u/4442179?v=4","gravatar_id":"","url":"https://api.github.com/users/jamiewinder","html_url":"https://github.com/jamiewinder","followers_url":"https://api.github.com/users/jamiewinder/followers","following_url":"https://api.github.com/users/jamiewinder/following{/other_user}","gists_url":"https://api.github.com/users/jamiewinder/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiewinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiewinder/subscriptions","organizations_url":"https://api.github.com/users/jamiewinder/orgs","repos_url":"https://api.github.com/users/jamiewinder/repos","events_url":"https://api.github.com/users/jamiewinder/events{/privacy}","received_events_url":"https://api.github.com/users/jamiewinder/received_events","type":"User","site_admin":false},"labels":[{"id":188063138,"url":"https://api.github.com/repos/aspnet/Mvc/labels/investigate","name":"investigate","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"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},"assignees":[{"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}],"milestone":null,"comments":3,"created_at":"2018-05-21T14:59:45Z","updated_at":"2018-05-21T19:15:11Z","closed_at":null,"author_association":"NONE","body":"I want to use the new `[ApiController]` attribute for the automatic '400 if model state is invalid behaviour', but still be explicit about the binding of parameters. For example:\r\n```c#\r\n[HttpGet]\r\npublic async Task<ActionResult> GetItems(\r\n            CancellationToken cancel,\r\n            [FromQuery]OffsetDateTime fromTime,\r\n            [FromQuery]OffsetDateTime toTime)\r\n```\r\nI have a custom model binder for handling those NodaTime types, but they're receiving `null` as the model value, presumably because ASP.NET is still trying to read them from the body because of the ApiController attribute. If I remove the attribute it works again. \r\n\r\nI had assumed that by being explicit about the binding source on the method, it'd override the  behaviour defined by a controller attribute, but this doesn't seem to be the case?\r\n\r\n(As an aside, can I opt-in *just* the model state handling, but not the other behaviours of `ApiController`?)"},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/390753853","html_url":"https://github.com/aspnet/Mvc/issues/7799#issuecomment-390753853","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/7799","id":390753853,"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-05-21T19:15:11Z","updated_at":"2018-05-21T19:15:11Z","author_association":"MEMBER","body":"Does this work:\r\n\r\n```c#\r\n.ConfigureLogging(factory =>\r\n                {\r\n                    factory\r\n                        .AddConsole()\r\n                        .AddDebug()\r\n                       .SetMinimumLevel(LogLevel.Trace);\r\n                })\r\n```"}}
{"actor":{"display_login":"pranavkm"}}