Created
January 31, 2018 13:02
-
-
Save stevejgordon/e3735eb251ab9374de41c1ef0953da68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof(IStartup).GetTypeInfo().IsAssignableFrom(startupType.GetTypeInfo())) | |
{ | |
services.AddSingleton(typeof(IStartup), startupType); | |
} | |
else | |
{ | |
services.AddSingleton(typeof(IStartup), sp => | |
{ | |
var hostingEnvironment = sp.GetRequiredService<IHostingEnvironment>(); | |
return new ConventionBasedStartup(StartupLoader.LoadMethods(sp, startupType, hostingEnvironment.EnvironmentName)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment