private Action GetConfigureServicesdDelegateAsAction(object instance, IServiceCollection serviceCollection) { if (MethodLoader.TryGetMethodInfo <IServiceCollection>(instance.GetType(), $"Configure{_environment.EnvironmentName}Services", out var configureServicesMethod)) { return(MethodLoader.GetMethod(instance, $"Configure{_environment.EnvironmentName}Services", serviceCollection)); } else { return(MethodLoader.GetMethod(instance, nameof(IStartup.ConfigureServices), serviceCollection)); } }
private (IStartup startup, IServiceProvider provider) GetConventionalStartup(object instance, IServiceCollection serviceCollection) { var configureServicesMethod = GetConfigureServicesdDelegate(instance, serviceCollection); var startup = new ConventionBasedStartup(instance) { ConfigurationCallBack = configureServicesMethod }; startup.ConfigureServices(serviceCollection); var provider = serviceCollection.BuildServiceProvider(); var runMethod = MethodLoader.GetMethod(instance, nameof(IStartup.Run), _app, _environment); startup.RunCallback = runMethod; return(startup, provider); }