Guest User

Untitled

a guest
Aug 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public IServiceProvider ConfigureServices(IServiceCollection services)
  2. {
  3. services.AddMvc().AddControllersAsServices();
  4.  
  5. var container = new Container().WithDependencyInjectionAdapter(services);
  6. return container.ConfigureServiceProvider<CompositionRoot>();
  7. }
  8.  
  9. var builder = new HostBuilder()
  10. .ConfigureAppConfiguration((hostingContext, config) => { ... })
  11. .ConfigureServices((hostContext, services) =>
  12. {
  13. services.AddOptions();
  14. // configure services
  15. })
  16. .ConfigureLogging((hostingContext, logging) => { ... });
  17.  
  18. var builder = new HostBuilder()
  19. .ConfigureAppConfiguration((hostingContext, config) => { ... })
  20. .ConfigureServices((hostContext, services) =>
  21. {
  22. services.AddOptions();
  23. // configure services
  24. })
  25. .ConfigureLogging((hostingContext, logging) => { ... })
  26. .UseStartup<Startup>(); //<-- That Startup class would have the `IServiceProvider ConfigureServices`
Add Comment
Please, Sign In to add comment