Default service creation for ASP.NET 5 ServiceProvider

。_饼干妹妹 提交于 2019-12-06 06:20:23

问题


I'm using DNX and the default Microsoft.Extensions.DependencyInjection.ServiceProvider for DI.

I am used to Ninject where if I haven't registered a service, it defaults to using the service type as the implementation type, e.g. if I haven't registered MyService and I ask the container for an instance of MyService (or it's a constructor parameter), it uses MyService as the implementation type.

Is there a way to configure Microsoft.Extensions.DependencyInjection.ServiceProvider to behave similarly? I would like it to create a Transient instance for anything unregistered.

来源:https://stackoverflow.com/questions/34167161/default-service-creation-for-asp-net-5-serviceprovider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!