Reduce the usage of BuildServiceProvider
This commit is contained in:
@@ -16,13 +16,29 @@ namespace Umbraco.Web.UI.BackOffice
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IConfiguration _config;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="webHostEnvironment"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <remarks>
|
||||
/// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337
|
||||
/// </remarks>
|
||||
public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
|
||||
_config = config ?? throw new ArgumentNullException(nameof(config));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddUmbracoConfiguration();
|
||||
services.AddUmbracoCore();
|
||||
services.AddUmbracoConfiguration(_config);
|
||||
services.AddUmbracoCore(_webHostEnvironment);
|
||||
services.AddUmbracoWebsite();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user