Conversation
|
Hosting.Create() basically is the new fallback service provider method with this change... |
|
Question, do we want to allow the additional services to override the fallback ones? Currently we add the fallback services after the additional, so I'd just have to flip the order we add the services when Importing if we want to enable overriding behavior... |
|
@HaoK what about making this |
There was a problem hiding this comment.
@davidfowl The code here, is passing the collection to the manifest
The complication with making it an Action, is that we need to be able to figure out what services were added so we add them to the manfiest. If we take the ServiceCollection itself rather than the action, we know that every service in there should be part of the manivest. If we simply run the action as part of the service collection we are building, we have no way to determine which services came from hosting (but shouldn't be exported), vs ones they really want added.
|
Updated with Action |
|
This makes me wonder if things would be simpler if we just queried for IEnumerable in the Import method instead. |
|
Good call on moving the bookkeeping to Import, makes the code quite compact now. Also found a few minor issues (missing null guard in ConfigureHostingEnvironment, and fixed an issue with the TestServer unit test using the wrong overload of TestServer.Create |
There was a problem hiding this comment.
Use named arguments when passing null.
9bbfebf to
91363bc
Compare
|
Updated PR removing optional parameters, and moving IConfiguration last for Create |
|
Reverted since 3 MVC functionals failed from this, need to investigate |
|
|
- needed to unblock Hosting PR: aspnet/Hosting#146 - Service fallback currently is broken with generic services (ILogger<> no worky) Hosting issue tracking: aspnet/Hosting#180
|
@HaoK I want one more overload: HostingServices.Create(Action<IServiceCollection> configureHostServices)That make the total 7 ! |
|
We should also look at cleaning up the API a bit. What purpose does the returned IServiceCollection serve if you can't add anything to it. |
|
Well, we use it to create the service collection, so we pass it around like in StartupLoader, and it seems nicer to let Create new up the Collection than require all callers to pass in the service collection they want to import into. The first iteration of this looked more like that, where it was Import instead of Create and took the collection as a parameter. |
|
Overload added 28cc37d |
Fixes #145