{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/3578","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/3578/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/3578/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/3578/events","html_url":"https://github.com/aspnet/Mvc/issues/3578","id":117646578,"number":3578,"title":"[Discussion] FromServicesAttribute is no longer applicable on controller or model properties","user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars.githubusercontent.com/u/174281?v=3","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},"labels":[{"url":"https://api.github.com/repos/aspnet/Mvc/labels/discussion","name":"discussion","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/aspnet/Mvc/milestones/18","html_url":"https://github.com/aspnet/Mvc/milestones/Discussion","labels_url":"https://api.github.com/repos/aspnet/Mvc/milestones/18/labels","id":1254581,"number":18,"title":"Discussion","description":"","creator":{"login":"Eilon","id":202643,"avatar_url":"https://avatars.githubusercontent.com/u/202643?v=3","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":1,"state":"open","created_at":"2015-08-14T02:04:42Z","updated_at":"2015-11-18T18:17:28Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-11-18T18:12:03Z","updated_at":"2015-11-18T20:47:41Z","closed_at":null,"body":"`FromServicesAttribute` used to be applicable on properties and parameters. The former allowed services to be bound on controller and model properties. However there was a lot of confusion as to where and how this worked.\r\n\r\nThis change, limits `FromServicesAttribute` to only work with action arguments. `FromServices` on controller properties can be replaced by a DI framework that support property injection. \r\n\r\nSee https://github.com/aspnet/Mvc/issues/3507 for discussion for past discussions for this change."},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/157858934","html_url":"https://github.com/aspnet/Mvc/issues/3578#issuecomment-157858934","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/3578","id":157858934,"user":{"login":"tuespetre","id":4853540,"avatar_url":"https://avatars.githubusercontent.com/u/4853540?v=3","gravatar_id":"","url":"https://api.github.com/users/tuespetre","html_url":"https://github.com/tuespetre","followers_url":"https://api.github.com/users/tuespetre/followers","following_url":"https://api.github.com/users/tuespetre/following{/other_user}","gists_url":"https://api.github.com/users/tuespetre/gists{/gist_id}","starred_url":"https://api.github.com/users/tuespetre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuespetre/subscriptions","organizations_url":"https://api.github.com/users/tuespetre/orgs","repos_url":"https://api.github.com/users/tuespetre/repos","events_url":"https://api.github.com/users/tuespetre/events{/privacy}","received_events_url":"https://api.github.com/users/tuespetre/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T20:47:41Z","updated_at":"2015-11-18T20:47:41Z","body":"Switching to use another DI container would be awesome if I wanted to do all sorts of Mickey Mouse shit like scan unknown assemblies and manipulate a newly-activated instance of a service, but as far as I can tell, switching to another DI container does **exactly nothing** in relation to binding a service to a model property. All it does is return a different implementation of `IServiceContainer` from `ConfigureServices`. With the change that has been made here, whether they use another DI container or not, developers who want to bind services to controller and model properties are going to have to plumb it out themselves using the constructs provided by the MVC framework. Feel free to prove me wrong! \r\n\r\nIt will be mildly annoying to have to put this snippet of plumbing into the root of all or most of my projects...\r\n\r\n```\r\nusing System;\r\n\r\n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]\r\npublic class FromServicesAttribute : Microsoft.AspNet.Mvc.FromServicesAttribute\r\n{\r\n}\r\n```\r\n\r\n...when the team could have just put a better, more descriptive summary on `FromServicesAttribute`:\r\n\r\n```\r\n/// <summary>\r\n/// Specifies that a controller action parameter, controller property, or model property should be bound using the request services during model binding.\r\n/// </summary>\r\n```\r\n\r\nI just don't feel like the team considered the very real-world scenarios that I outlined in my previous comments when making this decision. I have commented on [the commit that removed the property attribute target](https://github.com/aspnet/Mvc/commit/2a89caed05a1bc9f06d32e15d984cd21598ab6fb) to point out where I think a red flag should have gone up."}}