As far as I know, one of the main reasons why this has been eliminated is related to the confusion about where it works and where not. For example, FromServices was the concept of MVC model binding, and some users tried to use it outside of MVC and found that it did not work.
However, you can create your own model binding attribute to achieve similar behavior.
For example, this works with decoration on a model. NOTE I have not tested wit on a controller property.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class FromDIAttribute : Attribute, IBindingSourceMetadata { public BindingSource BindingSource { get { return BindingSource.Services; } } } public class Customer { [FromDI] public IFooService FooService { get; set; } public string Name { get; set; } }
UPDATE :
Found an ad for his removal here: https://github.com/aspnet/Announcements/issues/115
Kiran challa
source share