Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AppServiceProviderFactory to use WebHostFactoryResolver #10100

Merged
merged 1 commit into from
Oct 20, 2017

Conversation

javiercn
Copy link
Member

Uses the new shared sources package we created to abstract the aspnet templates host initialization logic. It finds either
IWebHostBuilder CreateWebHostBuilder(string[] args) or
IWebHost BuildWebHost(string[] args)
and provides a factory method that can be used to produce an IWebHost instance

@javiercn javiercn requested a review from bricelam October 17, 2017 19:14
@bricelam bricelam self-assigned this Oct 20, 2017
_reporter.WriteVerbose(DesignStrings.NoBuildWebHost(webHostFactoryResult.ProgramType.DisplayName()));
return null;
default:
throw new InvalidOperationException("Can't get here.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer this pattern:

Debug.Fail("Unexpected value: " + webHostFactoryResult.ResultKind);
return null;

var programType = FindProgramClass();
if (programType == null)
var webHostFactoryResult = WebHostFactoryResolver.ResolveWebHostFactory<object, object>(_startupAssembly);
switch (webHostFactoryResult.ResultKind)
Copy link
Contributor

Choose a reason for hiding this comment

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

It may not be important to preserve all these messages. If you think it's more maintainable to replace them with a generic "can't find web host factory" message, I won't push back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants