Remove ununsed and unneeded DbProviderFactory CreateFactory(); from IDbProviderFactoryCreator, ensure the app doesn't explode if exceptions are thrown and boot fails
This commit is contained in:
@@ -173,9 +173,10 @@ namespace Umbraco.Extensions
|
||||
if (container is null) throw new ArgumentNullException(nameof(container));
|
||||
if (entryAssembly is null) throw new ArgumentNullException(nameof(entryAssembly));
|
||||
|
||||
|
||||
services.AddUmbracoSqlCeSupport();
|
||||
services.AddUmbracoSqlServerSupport();
|
||||
|
||||
services.AddSingleton<IDbProviderFactoryCreator>(x => new DbProviderFactoryCreator(
|
||||
x.GetService<Configs>().ConnectionStrings()[Core.Constants.System.UmbracoConnectionName]?.ProviderName,
|
||||
DbProviderFactories.GetFactory,
|
||||
x.GetServices<ISqlSyntaxProvider>(),
|
||||
x.GetServices<IBulkSqlInsertProvider>(),
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StackExchange.Profiling;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Common.Middleware;
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
public static class UmbracoRequestApplicationBuilderExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseUmbracoRequest(this IApplicationBuilder app)
|
||||
// TODO: Could be internal or part of another call - this is a required system so should't be 'opt-in'
|
||||
public static IApplicationBuilder UseUmbracoRequestLifetime(this IApplicationBuilder app)
|
||||
{
|
||||
if (app == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(app));
|
||||
}
|
||||
if (app == null) throw new ArgumentNullException(nameof(app));
|
||||
|
||||
var runtime = app.ApplicationServices.GetRequiredService<IRuntime>();
|
||||
// can't continue if boot failed
|
||||
if (runtime.State.Level <= RuntimeLevel.BootFailed) return app;
|
||||
|
||||
app.UseMiddleware<UmbracoRequestMiddleware>();
|
||||
app.UseMiddleware<MiniProfilerMiddleware>();
|
||||
|
||||
Reference in New Issue
Block a user