问题
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