Remove HostBuilder UseUmbraco extension, it's not required.
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
{
|
||||
/// <summary>
|
||||
/// Extends the <see cref="IHostBuilder"/> to add CoreRuntime as a HostedService
|
||||
/// </summary>
|
||||
public static class HostBuilderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds CoreRuntime as HostedService
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Should be called before ConfigureWebDefaults.
|
||||
/// </remarks>
|
||||
public static IHostBuilder UseUmbraco(this IHostBuilder builder)
|
||||
{
|
||||
_ = builder.ConfigureServices((context, services) =>
|
||||
services.AddSingleton<IHostedService>(factory => factory.GetRequiredService<IRuntime>()));
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ namespace Umbraco.Tests.Integration
|
||||
var testHelper = new TestHelper();
|
||||
|
||||
var hostBuilder = new HostBuilder()
|
||||
.UseUmbraco()
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
var webHostEnvironment = testHelper.GetWebHostEnvironment();
|
||||
|
||||
@@ -153,7 +153,6 @@ namespace Umbraco.Tests.Integration.Testing
|
||||
public virtual IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
var hostBuilder = Host.CreateDefaultBuilder()
|
||||
.UseUmbraco()
|
||||
// IMPORTANT: We Cannot use UseStartup, there's all sorts of threads about this with testing. Although this can work
|
||||
// if you want to setup your tests this way, it is a bit annoying to do that as the WebApplicationFactory will
|
||||
// create separate Host instances. So instead of UseStartup, we just call ConfigureServices/Configure ourselves,
|
||||
|
||||
@@ -146,7 +146,9 @@ namespace Umbraco.Core.DependencyInjection
|
||||
builder.Services.AddUnique<IRuntimeState, RuntimeState>();
|
||||
builder.Services.AddUnique<IHostingEnvironment, AspNetCoreHostingEnvironment>();
|
||||
builder.Services.AddUnique<IMainDom, MainDom>();
|
||||
|
||||
builder.Services.AddUnique<IRuntime, CoreRuntime>();
|
||||
builder.Services.AddHostedService<IRuntime>(factory => factory.GetRequiredService<IRuntime>());
|
||||
|
||||
builder.AddCoreInitialServices();
|
||||
builder.AddComposers();
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace Umbraco.Web.UI.NetCore
|
||||
{
|
||||
x.ClearProviders();
|
||||
})
|
||||
.UseUmbraco()
|
||||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user