Out-of-date models status flag is created when using SourceCodeManual and Development Runtime (#14966)

* Update UmbracoBuilderDependencyInjectionExtensions.cs

* Remove duplicate OutOfDateModelStatus handlers

---------

Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
Jannik Anker
2023-10-16 10:46:58 +02:00
committed by GitHub
parent 1b3642e7f3
commit 4520fbe5b8

View File

@@ -114,8 +114,6 @@ public static class UmbracoBuilderDependencyInjectionExtensions
builder.AddInMemoryModelsRazorEngine();
builder.AddNotificationHandler<ModelBindingErrorNotification, ModelsBuilderNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, OutOfDateModelsStatus>();
builder.AddNotificationHandler<DataTypeCacheRefresherNotification, OutOfDateModelsStatus>();
}
if (builder.Config.GetRuntimeMode() != RuntimeMode.Production)
@@ -128,12 +126,16 @@ public static class UmbracoBuilderDependencyInjectionExtensions
builder.AddNotificationHandler<UmbracoRequestEndNotification, AutoModelsNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, AutoModelsNotificationHandler>();
builder.AddNotificationHandler<DataTypeCacheRefresherNotification, AutoModelsNotificationHandler>();
builder.AddNotificationHandler<ContentTypeCacheRefresherNotification, OutOfDateModelsStatus>();
builder.AddNotificationHandler<DataTypeCacheRefresherNotification, OutOfDateModelsStatus>();
}
builder.Services.TryAddSingleton<IModelsBuilderDashboardProvider, NoopModelsBuilderDashboardProvider>();
// Register required services for ModelsBuilderDashboardController
builder.Services.AddSingleton<IModelsGenerator, ModelsGenerator>();
// TODO: Remove in v13 - this is only here in case someone is already using this generator directly
builder.Services.AddSingleton<ModelsGenerator>();
builder.Services.AddSingleton<OutOfDateModelsStatus>();
@@ -163,6 +165,7 @@ public static class UmbracoBuilderDependencyInjectionExtensions
// This is what the community MB would replace, all of the above services are fine to be registered
builder.Services.AddSingleton<IPublishedModelFactory>(factory => factory.CreateDefaultPublishedModelFactory());
return builder;
}
}