Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Allow overriding the hosting service provider #1325

Merged
merged 9 commits into from
Feb 1, 2018

Conversation

davidfowl
Copy link
Member

Replaces #1322

ENikS and others added 9 commits January 30, 2018 18:30
@@ -202,6 +202,22 @@ public IWebHost Build()
host.Dispose();
throw;
}

IServiceProvider GetProviderFromFactory(IServiceCollection collection)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used once and not complex, inline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should remain a method. It's not like it's 2 lines of code. It's a few.


// Don't bother calling CreateBuilder since it just returns the default service collection
applicationServiceProvider = serviceProviderFactory.CreateServiceProvider(services);
var builder = serviceProviderFactory.CreateBuilder(services);
Copy link
Member

@ENikS ENikS Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it guaranteed that factory exists? What if serviceProviderFactory is null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been the case since 2.0. There’s always one registered. Unless somebody removes it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shrug it's a weird use of embedded methods.

@davidfowl davidfowl merged commit 6b095cf into dev Feb 1, 2018
@davidfowl davidfowl deleted the davidfowl/override-hosting-service-provider branch November 2, 2018 07:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants