Cleans up ext methods and where they are located and what they call to ensure dependencies are taken care of, cleans up Startup, moves routing appropriately

This commit is contained in:
Shannon
2020-05-12 15:18:55 +10:00
parent 4107ccdb12
commit bcaede22f1
12 changed files with 195 additions and 200 deletions

View File

@@ -0,0 +1,27 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using SixLabors.ImageSharp.Web.DependencyInjection;
using Umbraco.Core;
using Umbraco.Extensions;
using Umbraco.Web.Common.Middleware;
namespace Umbraco.Web.Website.Extensions
{
public static class UmbracoWebsiteApplicationBuilderExtensions
{
public static IApplicationBuilder UseUmbracoWebsite(this IApplicationBuilder app)
{
if (app == null) throw new ArgumentNullException(nameof(app));
if (!app.UmbracoCanBoot()) return app;
// Important we handle image manipulations before the static files, otherwise the querystring is just ignored.
// TODO: Since we are dependent on these we need to register them but what happens when we call this multiple times since we are dependent on this for UseUmbracoBackOffice too?
app.UseImageSharp();
app.UseStaticFiles();
return app;
}
}
}