public void ConfigureServices(IServiceCollection services)
        {
            IWebHostServiceProfileLoader loader = new WebHostServiceProfileLoader();

            loader.Load(services, Configuration, Environment);
            //loader.LoadFromAssembly(services, Configuration, Environment, typeof(Startup).Assembly);
            //loader.LoadFromAssemblies(services, Configuration, Environment, new Assembly[] {typeof(Startup).Assembly});
        }
示例#2
0
 public static IWebHostBuilder ConfigureServicesWithProfiles(this IWebHostBuilder builder, Action <WebHostBuilderContext, IServiceCollection> configureDelegate, params Assembly[] assemblies)
 {
     builder.ConfigureServices((context, services) =>
     {
         configureDelegate?.Invoke(context, services);
         IWebHostServiceProfileLoader loader = new WebHostServiceProfileLoader();
         loader.LoadFromAssemblies(services, context.Configuration, context.HostingEnvironment, assemblies);
     });
     return(builder);
 }