public void ConfigureEngineServices(IServiceCollection services, IConfiguration configuration, HarConfig config) { var typeFinder = new AppDomainTypeFinder(); var startupConfigurations = typeFinder.FindClassesOfType <IAppStartup>(); var instances = startupConfigurations.Select(t => (IAppStartup)Activator.CreateInstance(t)).OrderBy(o => o.Order); foreach (var instance in instances) { instance.ConfigureServices(services, configuration); } }
public void ConfigureContainer(ContainerBuilder builder, IConfiguration configuration) { var typeFinder = new AppDomainTypeFinder(); builder.RegisterInstance(this).As <IEngine>().SingleInstance(); builder.RegisterInstance(typeFinder).As <ITypeFinder>().SingleInstance(); var startupConfigurations = typeFinder.FindClassesOfType <IAppStartup>(); var instances = startupConfigurations.Select(t => (IAppStartup)Activator.CreateInstance(t)).OrderBy(o => o.Order); foreach (var instance in instances) { instance.ConfigureContainer(builder, configuration); } }