Initialize Current

This commit is contained in:
Bjarke Berg
2020-04-01 14:19:41 +02:00
parent e3ac778fc9
commit 400fa1ccd4
4 changed files with 33 additions and 7 deletions

View File

@@ -14,11 +14,13 @@ using Umbraco.Composing;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Web.BackOffice.AspNetCore;
using Umbraco.Web.Common.AspNetCore;
using Umbraco.Web.Common.Extensions;
using Umbraco.Web.Common.Runtime.Profiler;
using Umbraco.Web.Website.AspNetCore;
using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
namespace Umbraco.Web.UI.BackOffice
@@ -47,7 +49,7 @@ namespace Umbraco.Web.UI.BackOffice
public void ConfigureServices(IServiceCollection services)
{
services.AddUmbracoConfiguration(_config);
services.AddUmbracoCore(_webHostEnvironment);
services.AddUmbracoCore(_webHostEnvironment, out var factory);
services.AddUmbracoWebsite();
services.AddMvc();
@@ -55,6 +57,17 @@ namespace Umbraco.Web.UI.BackOffice
{
options.ShouldProfile = request => false; // WebProfiler determine and start profiling. We should not use the MiniProfilerMiddleware to also profile
});
//Finally initialize Current
Current.Initialize(
factory.GetInstance<ILogger> (),
factory.GetInstance<Configs>(),
factory.GetInstance<IIOHelper>(),
factory.GetInstance<IHostingEnvironment>(),
factory.GetInstance<IBackOfficeInfo>(),
factory.GetInstance<IProfiler>()
);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.